You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
close
Home > Projects > I noticed a “glitch” entry in the React and Eleventy starter projects’ package.json. What does that do?
I noticed a “glitch” entry in the React and Eleventy starter projects’ package.json. What does that do?
print icon

This is the property that enables React and Eleventy to run the build scripts in a full-stack environment and then serve the output as a static site.

 

Since the output will be served as a static site, it won’t consume project hours when your users visit it.  The only time your site will consume project hours is when you are working on it in the project editor.

 

If you are using the Glitch Eleventy or React starter:

You will see the property by default in the package.json.  Here’s what it looks like:

 

 "glitch": {

    "projectType": "generated_static"

  }

 

If you are working on a generated static site but you are not using one of the Glitch starters:

You can add the “glitch” property (as shown in the code snippet above) to the project’s package.json to prevent the live site from consuming project hours.

 

Notes:

  • The “glitch” property is only needed for generated static sites.

  • When using this property, it should always be entered using the exact same parameters as shown in the code snippet above.  If you change them, then the project editor will ignore it.

  • On Glitch, generated static sites are configured so that the site is served from the build folder. In the starter projects, you won’t see this folder because it is in .gitignore.   If your project doesn’t already have it, you will need to create a folder named “build” and make sure that the generated content is being saved there. Then, you can add it to .gitignore to save disk space.

  • If you would like to  learn more about package.json, check out this npm guide. 

Got more questions? Check out our Community Forum!
Open 24/7, the forum is where Glitch makers help each other and show off all the rad apps that they have created. It's the friendliest community of coders on the Web!
Feedback
0 out of 0 found this helpful

scroll to top icon