serveIndex is now serving wrong directory if having multiple paths in contentBasePublicPath
See original GitHub issue- Operating System: macOS Mojave (Version 10.14.6)
- Node Version: v14.4.0
NPM Version: 6.14.4οΌI usedyarn
)- Yarn Version: 1.22.4
- webpack Version: 4.43.0
- webpack-dev-server Version: 3.11.0
- Browser: Version 83.0.4103.97 (Official Build) (64-bit)
- This is a bug
- This is a modification request
Code
Repository link if needed.
// webpack.config.js
const path = require('path');
module.exports = {
devServer: {
open: true,
openPage: [ 'static1', 'static2', 'static3' ],
contentBase: [ path.join(__dirname, 'static1'), path.join(__dirname, 'static2'), path.join(__dirname, 'static3') ],
contentBasePublicPath: [ '/static1', '/static2', '/static3' ],
}
}
// Directory structure
$ tree -I "node_modules"
.
βββ package.json
βββ src
β βββ index.js
βββ static1
β βββ s1-dir1
β β βββ index.html
β βββ s1-dir2
β β βββ index.html
β βββ s1-dir3
β βββ index.html
βββ static2
β βββ s2-dir1
β β βββ index.html
β βββ s2-dir2
β β βββ index.html
β βββ s2-dir3
β βββ index.html
βββ static3
β βββ s3-dir1
β β βββ index.html
β βββ s3-dir2
β β βββ index.html
β βββ s3-dir3
β βββ index.html
βββ webpack.config.js
βββ yarn.lock
13 directories, 13 files
Expected Behavior
When running webpack-dev-server
, three pages should be opened.
They should be the following links respectively:
Also, since devServer.serveIndex
is true
by default, these pages should list the directory structure of ./static1
, ./static2
, ./static3
with the same structure as the actual directory .
Actual Behavior
For Bugs; How can we reproduce the behavior?
Just run webpeck-dev-server
(version 3.11.0), and one should be able to reproduce this behavior.
For Features; What is the motivation and/or use-case for the feature?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Webpack dev server does not recognize watchContentBase ...
When I run my server, I get the following error. Invalid options object. Dev Server has been initialized using an options object that...
Read more >webpack/webpack - Gitter
Now, that webpack does no longer expose process to the build, if you wan't to have process in the build, you need to...
Read more >webpack-dev-server | Yarn - Package Manager
Provide path to a webpack configuration file e.g. ./webpack.config.js. --config-name <value...> Name of the configuration to use. -m, --merge Merge two or moreΒ ......
Read more >r3f-react-app - CodeSandbox
appJsConfig);\n\n if (hasTsConfig && hasJsConfig) {\n throw new Error(\n 'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScriptΒ ...
Read more >docs: eject from create-react-app⦠- Cardano Updates
absolute path (e.g. `src/Components/Button.js`) but we set that up with ... single-page apps that may serve index.html for nested URLs like /todos/42.
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
Yes, no ETA, maybe end of the month
@alexander-akait
Sorry for late reply. I was not familiar with the GitHub notification system so I miss your mention. I just tried v4.0.0-beta.0 and it worked perfectly for my case. Thank you very much.
http://[::]:8080/static1/
http://[::]:8080/static2/
http://[::]:8080/static3/