I'm writing a node tool and I bundle it with webpack before publishing to npm (to have a fast execution with npx)
I don't need any loader / babel setup since it's pure JavaScript which is running fine under my current node 9. It used to work. The webpack config is trivial (13 lines).
However, when bundling, webpack latest (^3.10.0) complains on the spread syntax I started to use: (JS stage 3 at this date, but accepted by node 8.1+ and node 9)
Module parse failed: Unexpected token (47:2)
You may need an appropriate loader to handle this file type.
|
| return {
| ...SEC,
| listenToUncaughtErrors,
| listenToUnhandledRejections,
So why? The target (node) is accepting this syntax, and isn't webpack supposed to just bundle my code?
Is webpack parsing my code with an embedded JS interpreter? It seems so, but where can I find the specifications of this interpreter and see what features are supported?
I couldn't find anything in the doc. Similar questions here are not in a "no babel" configuration.
So why is webpack complaining here?
[edit] config and full code here and pasted here for your convenience:
module.exports = {
target: 'node',
entry: {
main: './src/index.js'
},
output: {
path: path.join(__dirname, '../dist'),
filename: 'bundled.js',
},
externals: {
conf: 'commonjs conf',
},
}