webpack-cli icon indicating copy to clipboard operation
webpack-cli copied to clipboard

Serve command not passing webpack `devServer` config to webpack-dev-server

Open lewisharveydeveloper opened this issue 6 years ago • 19 comments

reopening https://github.com/webpack/webpack-cli/issues/1469

here are my dev dependencies:

"devDependencies": {
    "@babel/core": "^7.12.3",
    "@babel/preset-env": "^7.12.1",
    "@babel/preset-react": "^7.12.1",
    "babel-loader": "^8.1.0",
    "react-hot-loader": "^4.13.0",
    "webpack": "^5.1.3",
    "webpack-cli": "^4.1.0",
    "webpack-dev-server": "^3.11.0"
  }

my dev server details:

devServer: { contentBase: path.join(__dirname, 'dist'), compress: true, port: 9000 }

Command: "start": "webpack serve --config ./webpack.config.js --mode development",

What is the current behavior?

i 「wds」: Project is running at http://localhost:9000/

i 「wds」: webpack output is served from undefined

i 「wds」: Content not from webpack is served from C:\Users\lehar\scaling-todo-app\dist

The first change i make reloads, any after that do not. The only way i can see updates is by stopping and reserving, even refreshing the page doesn't show updates.

Steps to reproduce the behavior:

Define a devServer config in your webpack config file Run webpack serve --config webpack.dev.js

lewisharveydeveloper avatar Oct 21 '20 20:10 lewisharveydeveloper

Closing https://github.com/webpack/webpack-cli/issues/1469#issuecomment-698267343

alexander-akait avatar Oct 21 '20 20:10 alexander-akait

No need to open an issue without additional information, I can't fix something somewhere

alexander-akait avatar Oct 21 '20 20:10 alexander-akait

No need to open an issue without additional information, I can't fix something somewhere

@evilebottnawi Sorry i accidentally submitted. Please reopen and see details

lewisharveydeveloper avatar Oct 21 '20 20:10 lewisharveydeveloper

@lewisharveydeveloper Please create reproducible test repo, can't reproduce locally

alexander-akait avatar Oct 21 '20 20:10 alexander-akait

@evilebottnawi https://github.com/lewisharveydeveloper/scaling-todo-app

see test string in app.js. when i change that string, i see the changes on first change, but no following changes

lewisharveydeveloper avatar Oct 21 '20 20:10 lewisharveydeveloper

@lewisharveydeveloper you need to set target: 'web', we are working on fixes

alexander-akait avatar Oct 21 '20 20:10 alexander-akait

@evilebottnawi set target to web and pushed changes to my shared repo. no change

lewisharveydeveloper avatar Oct 21 '20 20:10 lewisharveydeveloper

You need hot: true also

alexander-akait avatar Oct 21 '20 20:10 alexander-akait

@evilebottnawi Thanks for quick responses, set hot to true but no change unfortunately. (pushed to repo)

lewisharveydeveloper avatar Oct 21 '20 20:10 lewisharveydeveloper

I will look at the problem tmorrow

alexander-akait avatar Oct 21 '20 20:10 alexander-akait

@evilebottnawi Thank you :)

i've added more detail on the issue. seems like it might be something to do with cache since i don't even see changes once i refresh the tab.

lewisharveydeveloper avatar Oct 21 '20 20:10 lewisharveydeveloper

No problems, works fine

alexander-akait avatar Oct 29 '20 15:10 alexander-akait

Screenshot from 2020-10-29 18-00-59

alexander-akait avatar Oct 29 '20 15:10 alexander-akait

@evilebottnawi I am having this same issue: 「wds」: webpack output is served from undefined. And my live reloading does not work. I can confirm that using target: 'web' gets live reloading to work but I still get the same message 「wds」: webpack output is served from undefined. Is target: 'web' a temporary solution? I'm seeing that this problem might be fixed in #1469 but it doesn't look like those changes are published in a new version yet.

tx-steven avatar Oct 29 '20 19:10 tx-steven

@evilebottnawi i made a new folder and pulled my repo. I ran npm install, and then npm start. I still have the same problem, the first refresh works but no subsequent ones.

lewisharveydeveloper avatar Oct 29 '20 20:10 lewisharveydeveloper

@tx-steven Yes, target: 'web' is a temporary solution

@lewisharveydeveloper still can't reproduce, all works fine

alexander-akait avatar Oct 30 '20 14:10 alexander-akait

I want to close because I can't reproduce, there is not magic with new webpack serve, feel free to feedback

alexander-akait avatar Oct 30 '20 14:10 alexander-akait

In original repo it doesn't work, because you have resolving problems, so webpack can't init HMR, problems with code === problems with HMR, nothing to do here

alexander-akait avatar Oct 30 '20 14:10 alexander-akait

https://github.com/lewisharveydeveloper/scaling-todo-app/blob/master/src/index.js#L5 - no firebase in mode_modules

alexander-akait avatar Oct 30 '20 14:10 alexander-akait