-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(server): add contentBasePublicPath option
#2150
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
feat(server): add contentBasePublicPath option
#2150
Conversation
|
|
Codecov Report
@@ Coverage Diff @@
## master #2150 +/- ##
==========================================
+ Coverage 93.86% 93.88% +0.01%
==========================================
Files 34 34
Lines 1288 1291 +3
Branches 367 368 +1
==========================================
+ Hits 1209 1212 +3
Misses 78 78
Partials 1 1
Continue to review full report at Codecov.
|
alexander-akait
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide repo example with use case
|
Also you need accept CLA |
|
I signed CLA! |
|
https://github.com/iamandrewluca/plsdelete-wds-use-case Set |
|
sounds confused, you want handle static and public directory from one directory, but it is not good idea, why not use |
|
for example in create-react-app, you can set env In this issue is described the use case with example |
as I know |
|
Maybe |
|
Now I'm strugling with settings |
|
For example: handle |
|
In my app I set |
|
Use |
|
I think we misunderstood each other. /home/me/project/assets/
manifest.json{
contentBase: '/home/me/project/assets/',
contentBasePublicPath: '/url-path',
} |
|
oh, i see 👍 |
|
@evilebottnawi is there any reason why |
|
Because we should handle only |
|
@Flydiverny in my todo, next week will be new release, we need help here #2313 for release |
|
/cc @hiroppy can you look at this, i want to merge and do new release |
hiroppy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits
cd96602
Tell the server at what URL to serve `devServer.contentBase`. If there was a file `assets/manifest.json`, it would be served at `/serve-content-base-at-this-url/manifest.json`
__webpack.config.js__
```javascript
module.exports = {
//...
devServer: {
contentBase: path.join(__dirname, 'assets'),
contentBasePublicPath: '/serve-content-base-at-this-url'
}
};
```
Now `webpack-dev-server` serves static files (`contentBase`) from root ignoring `publicPath`
Using added option we can serve static files from `publicPath`
This use case is needed in create-react-app, when want to serve all files from `publicPath`
doesn't matter in development or production
facebook/create-react-app#7259
|
@hiroppy it's done! |
hiroppy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
|
Sorry for big delay, we really have very many issues and very few developers |
|
Thank you :) |

contentBasePublicPathexample webpack.js.org#3291Tell the server at what URL to serve
devServer.contentBase. If there was a fileassets/manifest.json, it would be served at/serve-content-base-at-this-url/manifest.jsonwebpack.config.js
Motivation / Use-Case
Now
webpack-dev-serverserves static files (contentBase) from root ignoringpublicPathUsing added option we can serve static files from
publicPathThis use case is needed in create-react-app, when want to serve all files from
publicPathdoesn't matter in development or production
https://github.com/iamandrewluca/plsdelete-wds-use-caseAbove repo will be deleted because does not reflect current changes after review.
From start the option was intended to be
contentBasePrependPublic: booleanBreaking Changes
No breaking changes
Related
facebook/create-react-app#7259
facebook/create-react-app#6135
facebook/create-react-app#6280