question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Respect NODE_ENV in chunks plugin

See original GitHub issue

I’ve been experiencing a little problem when running a production build, it seems that the chunks plugin always applies the publicPath from the devServer config:

https://github.com/halt-hammerzeit/universal-webpack/blob/master/source/chunks plugin.js#L56

Am I right, and if so, is this the desired behavior?

We’re solving it manually like so:

webpack.config.js:

{
    ...other config stuff
    devServer: process.env.NODE_ENV === 'production' ? {} : {
        ...content of devServer config
    }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
catamphetaminecommented, Mar 6, 2017

Check the new version of the package

0reactions
edorivaicommented, Mar 6, 2017

Yeah okay. I kinda like that we can add devServer to our base config file, and as for webpack, it only gets interpreted by the webpack-dev-server command, right? This is what caused my initial confusion, as I was assuming that devServer only gets applied in a dev environment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Passing environment-dependent variables in webpack
There are two basic ways to achieve this. DefinePlugin. new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify(process.env.
Read more >
Compilation Hooks | webpack
A plugin can tap into this hook to perform optimizations on chunks. ... The callback must respect the type of the tap method...
Read more >
Respect a .nvmrc file · Issue #116 - GitHub
json#engines field to find a matching node. A hypothetical nodenv-nvmrc plugin would be nearly identical: hook into the version lookup, exit ...
Read more >
Plugins - esbuild
The plugin API allows you to inject code into various parts of the build process. ... respect conditional package imports in the "import"...
Read more >
chunks-webpack-plugin - npm
The ChunksWebpackPlugin creates HTML files with entry points and chunks relations to serve your webpack bundles. It is suitable with multi-page ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found