webpack-dev-server: Webpack dev server respond 404 if set entry name or output.fileName with prefix ‘/’.
I’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
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (7 by maintainers)
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 😦