Webpack dev server respond 404 if set entry name or output.fileName with prefix ‘/’.
See original GitHub issueI’m submitting a bug report
Webpack version: 2.1.0-beta.25 webpack-dev-server@2.1.0-beta.9
Please tell us about your environment: Linux
Current behavior: If set entry name or output.fileName with prefix ‘/’,the entry file will be responded as 404.
Expected/desired behavior:
- If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: {
'/app': './src/index.js',
},
output: {
path: path.resolve(__dirname, "dist"),
filename: '[name].js'
},
devServer: {
historyApiFallback: true,
port: 3000,
watchOptions: {
aggregateTimeout: 300,
poll: 1000
}
}
};
OR
output: {
path: path.resolve(__dirname, "dist"),
filename: '/[name].js'
},
- What is the expected behavior?
- What is the motivation / use case for changing the behavior?
- Browser: all
- Language: all
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Webpack dev server respond 404 if set entry name or output ...
Current behavior: If set entry name or output.fileName with prefix '/',the entry file will be responded as 404. If the current behavior is...
Read more >Output - webpack
The top-level output key contains a set of options instructing webpack on how and where it should output your bundles, assets, and anything...
Read more >API - esbuild
To join a set of files together with esbuild, import them all into a single entry point file and bundle just that one...
Read more >webpack-dev-server - npm
Usage: webpack serve|server|s [entries...] [options] Run the webpack dev server. Options: -c, --config <value...> Provide path to a webpack ...
Read more >DevServer - webpack 3 documentation
With filename , it's possible to only compile when a certain file is requested. If output.filename is set to bundle.js and filename is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m having a similar issue that does not occur with
This is my webpack.common.js:
and this is my webpack.dev.js:
If I use webpack-dev-server@1.14.1 everything is fine, but with webpack-dev-server@2.1.0-beta.9 the resulting index.html is minified (which it shouldn’t be), also the
<script>and<link>tag URLs are wrong.Instead of
<script src="/app.js"></script>I get<script src="/dist/app.arandomhash.js"></script>.Can’t use 2.1.0-beta.9 then 😦
@SpaceK33z, thank you very much, I will help you as far as I can:).