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

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

Open
constgen opened this issue Jan 13, 2022 · 6 comments · May be fixed by #236
Open

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

constgen opened this issue Jan 13, 2022 · 6 comments · May be fixed by #236

Comments

@constgen
Copy link

  • 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}))); 
@shellscape
Copy link
Owner

Sounds like that fix might work. We'll need a specific test written for that change.

@constgen
Copy link
Author

Let me see how to do tests

@constgen constgen linked a pull request Jan 13, 2022 that will close this issue
8 tasks
@alielmajdaoui
Copy link

I am getting this too! webpack-plugin-serve v1.6.0

@constgen
Copy link
Author

Untill the moment I finish the PR I can recommend you to use this workaround. Configure settings of this plugin using this

historyFallback: {
   htmlAcceptHeaders: ["text/html", "*/*"],
   rewrites: []
},

@alielmajdaoui
Copy link

It did the trick! Could you explain what those 2 options do?

@constgen
Copy link
Author

For some reason during building historyFallback option is mutated. And our value in options is what it is changed to. So we define the same value that will not be detected as different by Webpack

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