Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document how to use with webpack-dev-server #49

Open
devkral opened this issue Jun 5, 2021 · 1 comment
Open

document how to use with webpack-dev-server #49

devkral opened this issue Jun 5, 2021 · 1 comment

Comments

@devkral
Copy link

devkral commented Jun 5, 2021

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
Copy link
Author

devkral commented Jun 10, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant