Skip to content

WARNING in DefinePlugin Conflicting values for 'ʎɐɹɔosǝʌɹǝs' #235

@constgen

Description

@constgen
  • Webpack Version: 5.38.1
  • Operating System (or Browser): Windows 10, Firefox 95.0.2
  • Node Version: v14.15.5
  • webpack-plugin-serve Version: 1.5.0

How Do We Reproduce?

  1. Build a project in dev and watch mode > webpack --mode development
  2. Open served page in the browser and refresh it (F5) al least one time
  3. Change something in the source code to trigger HMR

Expected Behavior

Rebuild should be done successfully without errors and warnings

Actual Behavior

Rebuild is done. Everything works. But this this warning is shown in the terminal of Webpack process

WARNING in DefinePlugin
Conflicting values for 'ʎɐɹɔosǝʌɹǝs'
'{"compress":null,"headers":null,"historyFallback":{},"hmr":"refresh-on-failure","host":"localhost","liveReload":false,"log":{"lev"minimal","ramdisk":false,"secure":false,"status":true,"client":{"silent":true,"retry":true},"waitForBuild":true,"address":"localhost:3000","compilerName":null,"wpsId":"fb5dfed"}' !== '{"compress":null,"headers":null,"historyFallback":{"htmlAcceptHeaders":["text/html","*/*"],"rewrites":[]},"hmr":"refresh-on-failure","host":"localhost","liveReload":false,"log":{"level":"info","timestamp":false,"prefix":{"template":"{{level}}"},"name":"webpack-plugin-serve"},"open":false,"port":3000,"progress":"minimal","ramdisk":false,"secure":false,"status":true,"client":{"silent":true,"retry":true},"waitForBuild":true,"address":"localhost:3000","compilerName":null,"wpsId":"fb5dfed"}'

And it is multiplied every time rebuild is triggered. So the terminal becomes higly polluted at some moment.

This happens because ʎɐɹɔosǝʌɹǝs is changed between rebuilds. The only difference is this part "historyFallback":{"htmlAcceptHeaders":["text/html","*/*"],"rewrites":[]}. I found that this object is mutated when it is passed to the 3rd party middleware on this line

app.use(convert(historyApiFallback(options.historyFallback)));
. We could fix it by making a clone of this parameter to preserve immutability. Is it true?

 app.use(convert(historyApiFallback({ ...options.historyFallback}))); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions