django-manifest-loader icon indicating copy to clipboard operation
django-manifest-loader copied to clipboard

document how to use with webpack-dev-server

Open devkral opened this issue 4 years ago • 1 comments

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

devkral avatar Jun 05 '21 10:06 devkral

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
}
}),

devkral avatar Jun 10 '21 21:06 devkral