Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Commit

Permalink
Prevent webpack from hanging during staging
Browse files Browse the repository at this point in the history
Staging was hanging indefinitely when it started optimizing assets
(part of the `npm run build` postinstall script).

I didn't investigate fully, but it seems to be related to Node's poor
grasp of system resources[1,2,3].

One suspect was identified in the build output:

```
> npm run build (node:46) MaxListenersExceededWarning: Possible
  EventEmitter memory leak detected. 11 SIGINT listeners added. Use
  emitter.setMaxListeners() to increase limit
```

[1] webpack/webpack#2012 (comment)
[2] webpack/webpack#4558
[3] webpack-contrib/sass-loader#100

Signed-off-by: Lee Porte <lee.porte@digital.cabinet-office.gov.uk>
  • Loading branch information
henrytk authored and paroxp committed Feb 27, 2020
1 parent fb9ad56 commit af941c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
applications:
- name: hackmd
instances: 1
memory: 2G
memory: 6G
buildpack: nodejs_buildpack
env:
PGSSLMODE: require
Expand Down
21 changes: 8 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@
"license": "AGPL-3.0",
"main": "app.js",
"scripts": {
"build": "webpack --config webpack.prod.js --display errors-only -p",
"dev": "webpack --config webpack.dev.js --progress --colors --watch",
"doctoc": "doctoc --title='# Table of Contents' README.md",
"lint": "standard",
"jsonlint": "find . -type f -not -ipath \"./node_modules/*\" \\( -name \"*.json\" -o -name \"*.json.*\" \\) | xargs -n 1 -I{} -- bash -c 'echo {}; jq . {} > /dev/null;'",
"start": "sequelize db:migrate && node app.js",
"mocha": "mocha --require intelli-espower-loader --exit ./test --recursive",
"mocha:ci": "mocha --no-color -R dot --require intelli-espower-loader --exit ./test --recursive",
"coverage": "nyc mocha --require intelli-espower-loader --exit --recursive ./test",
"coverage:ci": "nyc mocha --no-color -R dot --require intelli-espower-loader --exit --recursive ./test",
"test": "npm run-script lint && npm run-script jsonlint && npm run-script coverage",
"test:ci": "npm run-script lint && npm run-script jsonlint && npm run-script coverage:ci",
"postinstall": "npm run build"
"test": "npm run-script standard && npm run-script jsonlint",
"jsonlint": "find . -not -path './node_modules/*' -type f -name '*.json' -o -type f -name '*.json.example' | while read json; do echo $json ; jq . $json; done",
"standard": "node ./node_modules/standard/bin/cmd.js",
"dev": "webpack --config webpack.config.js --progress --colors --watch",
"build": "node --max-old-space-size=6144 node_modules/webpack/bin/webpack.js --config webpack.prod.js --progress --colors --bail",
"postinstall": "npm run build",
"start": "node app.js",
"doctoc": "doctoc --title='# Table of Contents' README.md"
},
"dependencies": {
"@hackmd/codemirror": "~5.46.2",
Expand Down

0 comments on commit af941c1

Please sign in to comment.