Conversation
legacyDecorators: true | ||
} | ||
}, | ||
emitWarning: process.env.NODE_ENV === 'development', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll likely be making this change upstream soon, see:
neutrinojs/neutrino#1131 (comment)
.neutrinorc.js
Outdated
'APPLICATION_NAME', | ||
'LOGIN_STRATEGIES', | ||
'TASKCLUSTER_ROOT_URL', | ||
]], | ||
(neutrino) => { | ||
if (process.env.NODE_ENV === 'development') { | ||
neutrino.config.devtool('cheap-module-source-map'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this to the devtool
option within @neutrinojs/react
, since it ensures terser-webpack-plugin will be configured correctly (switching to terser is currently unreleased; see neutrinojs/neutrino#1158).
Also, the default is cheap-module-eval-source-map
, which is likely faster for incremental builds (given eval), so unless there is some issue being encountered, might be best left at the default. See:
https://webpack.js.org/configuration/devtool/#devtool
.neutrinorc.js
Outdated
@@ -79,6 +168,10 @@ module.exports = { | |||
bindings: 'bindings' | |||
})); | |||
|
|||
// TODO: Why is this needed? | |||
neutrino.config.resolve.modules.add(MODULES); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend not adding this. If not having it causes an error, could you include it in the code comment? (And I'm happy to take a look)
.neutrinorc.js
Outdated
@@ -96,6 +189,8 @@ module.exports = { | |||
.test(/JSONStream/) | |||
.use('shebang') | |||
.loader('shebang-loader'); | |||
|
|||
console.log(JSON.stringify(neutrino.config.toConfig(), null, 2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually stringifying the config is not neccessary/gives worse output. Try:
neutrino --inspect --mode {development,production}
# or
NODE_ENV={development,production,test} neutrino --inspect
(https://master.neutrinojs.org/usage/#inspecting-the-generated-webpack-config)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
➜ taskcluster-web git:(neutrino-v9) ✗ neutrino --inspect --mode development
/Users/haali/Documents/Mozilla/projects/neutrino-dev/node_modules/webpack-chain/src/Plugin.js:11
this.init((Plugin, args = []) => new Plugin(...args));
^
TypeError: Plugin is not a constructor
at init (/Users/haali/Documents/Mozilla/projects/neutrino-dev/node_modules/webpack-chain/src/Plugin.js:11:40)
at Object.toConfig (/Users/haali/Documents/Mozilla/projects/neutrino-dev/node_modules/webpack-chain/src/Plugin.js:42:22)
at clean.Object.assign.plugins.plugins.values.map.plugin (/Users/haali/Documents/Mozilla/projects/neutrino-dev/node_modules/webpack-chain/src/Config.js:125:61)
at Array.map (<anonymous>)
at module.exports.toConfig (/Users/haali/Documents/Mozilla/projects/neutrino-dev/node_modules/webpack-chain/src/Config.js:125:40)
at module.exports.toString (/Users/haali/Documents/Mozilla/projects/neutrino-dev/node_modules/webpack-chain/src/Config.js:137:41)
at Object.output (/Users/haali/Documents/Mozilla/projects/neutrino-dev/packages/neutrino/index.js:27:37)
at Object.<anonymous> (/Users/haali/Documents/Mozilla/projects/neutrino-dev/packages/neutrino/bin/neutrino.js:9:20)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the globally yarn link
ed version of Neutrino is using an older version of webpack-chain. I would either:
- run
yarn neutrino ...
(in the hope that it favours the copy of Neutrino in the localnode_modules
) - remove the yarn link for neutrino
- update the
neutrino-dev
source directory tomaster
and runyarn
to install the latest version of deps
(I would suggest 1/2, otherwise we'll be debugging Neutrino master
rather than the known release version, which is not what yarn start
will be using)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created neutrinojs/neutrino#1167.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I am running a linked version of Neutrino. Running grep "webpack-chain" node_modules/neutrino/package.json
shows "webpack-chain": "^4.11.0",
. The update to webpack-chain was merged two days ago. Is it possible that it hasn't been published yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If neutrino
is on PATH
(ie neutrino
works and not just yarn neutrino
), it's a linked copy, or else PATH
has been manually adjusted.
That grep command is a red herring, since that will be grepping the local node_modules copy, not the copy that's being used from the linked neutrino.
Try running this:
ls -al $(yarn global bin)/neutrino
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the linked version of Neutrino works! Many thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome :-)
karma.conf.js
Outdated
|
||
process.env.NODE_ENV = process.env.NODE_ENV || 'test'; | ||
|
||
module.exports = neutrino().karma(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Missing end of file newline)
'react/no-did-mount-set-state': 'off', | ||
} | ||
} | ||
env: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it helps, this env
option now also supports the object-form that can take defaults for each variable.
.neutrinorc.js
Outdated
// TODO: Why is this needed? | ||
neutrino.config.resolve.modules.add(MODULES); | ||
// neutrino.config.resolveLoader.modules.add(MODULES); | ||
|
||
neutrino.config.output.publicPath('/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be set via the @neutrinojs/react
options now, which will also ensure the devserver equivalent option is set to a matching value automatically.
Blocked by neutrinojs/neutrino#1166. |
package.json
Outdated
"build": "yarn create:fragment-matcher && dotenv webpack -- --mode production", | ||
"start": "dotenv webpack-dev-server -- --mode development", | ||
"test": "karma start --single-run", | ||
"lint": "eslint --cache --format codeframe --ext mjs,js src test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be --ext mjs,jsx,js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, that was silly from my end. Sorry for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see it the first time I looked either 😆
270c712
to
765547f
Compare
None from me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm :-)
Fixes #154.