Skip to content
This repository has been archived by the owner on Sep 11, 2018. It is now read-only.

FAQ: Frequently Asked Questions

Emil Ahlbäck edited this page Jan 17, 2017 · 6 revisions

Want Semicolons?

After installing npm dependencies, open .eslintrc, change the semi rule from never to always, and then run npm run lint:fix -- Easy as that! Alternatively, use the same npm script after installing and extending your preferred ESLint configuration; it's easy to customize the project's code style to suit your team's needs. See, we can coexist peacefully.

Babel Issues

Running into issues with Babel? Babel 6 can be tricky, please either report an issue or try out the stable v0.18.1 release with Babel 5. If you do report an issue, please try to include relevant debugging information such as your node, npm, and babel versions.

Babel Polyfill

By default this repo does not bundle the babel polyfill in order to reduce bundle size. If you want to include it, you can use this commit from jokeyrhyme as a reference.

Internationalization Support

In keeping with the goals of this project, no internationalization support is provided out of the box. However, juanda99 has been kind enough to maintain a fork of this repo with internationalization support, check it out!

Deployment Issues (Generally Heroku)

Make sure that your environment is installing both dependencies and devDependencies, since the latter are required to build the application. You can also reference this issue for more details.

High editor CPU usage after compilation

While this is common to any sizable application, it's worth noting for those who may not know: if you happen to notice higher CPU usage in your editor after compiling the application, you may need to tell your editor not to process the dist folder. For example, in Sublime you can add:

	"folder_exclude_patterns": [".svn",	".git",	".hg", "CVS",	"node_modules",	"dist"]

Heroku Deployment

Heroku has nodejs buildpack script that does the following when you deploy your app to Heroku.

  1. Find packages.json in the root directory.
  2. Install nodejs and npm packages.
  3. Run npm postinstall script
  4. Run npm start

Therefore, you need to modify package.json before deploying to Heroku. Make the following changes in the scripts section of package.json.

...
"start": "better-npm-run start:prod",
"serve": "better-npm-run start",
"postinstall": "npm run deploy:prod",
"betterScripts": {
  ...
  "start:prod": {
    "command": "node bin/server",
    "env": {
      "NODE_ENV": "production"
    }
  }
  ...
},

It's also important to tell Heroku to install all devDependencies to successfully compile your app on Heroku's environment. Run the following in your terminal.

$ heroku config:set NPM_CONFIG_PRODUCTION=false

With this setup, you will install all the necessary packages, build your app, and start the webserver (e.g. koa) everytime you push your app to Heroku. Try to deploy to Heroku by running the following commands.

$ git add .
$ git commit -m 'My awesome commit'
$ git push heroku master

If you fail to deploy for an unknown reason, try this helpful comment by DonHansDampf addressing Heroku deployments.