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

dev-server: Stop setting contentBase #1165

Merged
merged 1 commit into from Oct 11, 2018

Conversation

@edmorley
Copy link
Member

edmorley commented Oct 11, 2018

By default webpack-dev-server attempts to serve webpack-generated files in response to requests, followed by passing them on to any proxy (if set). However when the contentBase setting is used, requests can also fall back to any file in the specified directory, even if it's not part of the webpack build:
https://webpack.js.org/configuration/dev-server/#devserver-contentbase

This can cause confusion since when performing a production build, webpack-dev-server isn't used so no such fallback occurs, meaning a seemingly working dev site then might not work in production.

The contentBase option has been set since Neutrino 4:
30e3f5b#diff-92e7b3255c5e8759497a7b3247b2e1e8R161

...and I believe is a leftover from the time when copy-webpack-plugin (prior to v2.0.1) didn't support making the copied files available to webpack-dev-server.

@edmorley edmorley added this to the v9 milestone Oct 11, 2018
@edmorley edmorley self-assigned this Oct 11, 2018
@edmorley edmorley force-pushed the edmorley:devserver-no-contentbase branch from 0a3d4ec to 2a44d3d Oct 11, 2018
@edmorley edmorley requested a review from eliperelman Oct 11, 2018
By default webpack-dev-server attempts to serve webpack-generated
files in response to requests, followed by passing them on to any
proxy (if set). However when the `contentBase` setting is used,
requests can also fall back to any file in the specified directory,
even if it's not part of the webpack build.

This can cause confusion since when performing a production build,
webpack-dev-server isn't used so no such fallback occurs, meaning
a seemingly working dev site then might not work in production.

The `contentBase` option has been set since Neutrino 4:
30e3f5b#diff-92e7b3255c5e8759497a7b3247b2e1e8R161

...and I believe is a leftover from the time when `copy-webpack-plugin`
(prior to v2.0.1) didn't support making the copied files available to
webpack-dev-server.
@edmorley edmorley force-pushed the edmorley:devserver-no-contentbase branch from 2a44d3d to dedc3f1 Oct 11, 2018
@edmorley edmorley requested a review from timkelty Oct 11, 2018
Copy link
Contributor

timkelty left a comment

Yep, this sounds/looks right to me! Did a quick test and didn't break anything for me on an existing project, either.

@edmorley edmorley merged commit 7c60814 into neutrinojs:master Oct 11, 2018
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details
@edmorley edmorley deleted the edmorley:devserver-no-contentbase branch Oct 11, 2018
@edmorley edmorley added the bug label Oct 11, 2018
@edmorley

This comment has been minimized.

Copy link
Member Author

edmorley commented Oct 11, 2018

Thank you for the review(s) :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.