nodemon-webpack-plugin: Crash on [hash] or [name] in webpack output filename
When you have a webpack config like: (example)
module.exports = {
entry: './src/index.js',
output: {
filename: '[name]-[hash].js',
path: 'dist'
}
}
Webpack will fail starting with this error:
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.4.0
npm info lifecycle app-core@1.0.0~prewatch: app-core@1.0.0
npm info lifecycle app-core@1.0.0~watch: app-core@1.0.0
> app-core@1.0.0 watch /usr/app
> NODE_ENV=development webpack --watch
Webpack is watching the files…
ts-loader: Using typescript@2.5.2 and /usr/app/tsconfig.json
/usr/app/node_modules/nodemon-webpack-plugin/dist/index.js:14
var absoluteFileName = asset.existsAt;
^
TypeError: Cannot read property 'existsAt' of undefined
at getOutputFileMeta (/usr/app/node_modules/nodemon-webpack-plugin/dist/index.js:14:33)
at Compiler.<anonymous> (/usr/app/node_modules/nodemon-webpack-plugin/dist/index.js:43:46)
at Compiler.applyPluginsAsyncSeries1 (/usr/app/node_modules/tapable/lib/Tapable.js:222:13)
at Compiler.afterEmit (/usr/app/node_modules/webpack/lib/Compiler.js:365:9)
at require.forEach.err (/usr/app/node_modules/webpack/lib/Compiler.js:354:15)
at /usr/app/node_modules/async/dist/async.js:421:16
at iteratorCallback (/usr/app/node_modules/async/dist/async.js:998:13)
at /usr/app/node_modules/async/dist/async.js:906:16
at /usr/app/node_modules/graceful-fs/graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:135:15)
npm info lifecycle app-core@1.0.0~watch: Failed to exec watch script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app-core@1.0.0 watch: `NODE_ENV=development webpack --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app-core@1.0.0 watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
getOutputFileMeta
will give an error, because the name [name].js
is not in the assets (only the compiled name: index.js
).
It would be nice if the plugin could convert these filenames.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 25 (11 by maintainers)
I got a similar error:
Fixed in https://github.com/Izhaki/nodemon-webpack-plugin/commit/8475d3f7c3b9aecedaa2e3af61c77105d94b32c0
I’ll have a look tonight (GMT).