django-manifest-loader
django-manifest-loader copied to clipboard
document how to use with webpack-dev-server
For debugging it is better to have webpack-dev-server active. Sadly it is a bit tricky to configure: webpack.config.js
module.exports = (env, options) =>({
...
devServer: {
port: '8080'
},
plugins: {
new CleanWebpackPlugin({
verbose: true,
//important elsewise minifest.json is deleted
cleanOnceBeforeBuildPatterns: ['**/*', '!manifest.json'],
}),
new WebpackManifestPlugin({
writeToFileEmit: true,
publicPath: env['WEBPACK_SERVE'] ? 'http://localhost:8080/' : null,
}),
})
it would be nice to include this trick in the documentation
My project uses this setup: https://github.com/devkral/secretgraph
there is a much nicer way:
module.exports = (env, options) =>({
...
devServer: {
port: '8080',
devMiddleware: {
writeToDisk: true,
},
headers: {
'Access-Control-Allow-Origin': '*'
},
},
plugins: [
new WebpackManifestPlugin({
writeToFileEmit: true,
}),
],
output: {
...
# replaces clean plugin
clean: true
}
}),