fix(build): override publicPath for ExtractTextPlugin#4036
fix(build): override publicPath for ExtractTextPlugin#4036filipesilva merged 1 commit intoangular:masterfrom
Conversation
|
@changLiuUNSW can you add a test for this case? I want to ensure we don't break it in the future. A good test would be new file |
d56a661 to
19efaa1
Compare
|
@filipesilva |
filipesilva
left a comment
There was a problem hiding this comment.
There's a change I'm requesting regarding correctness that is important (checking the generated path), the others are minor changes.
| // build with deloyUrl | ||
| .then(() => ng('build', '--deploy-url=client/')) | ||
| .then(() => expectFileToMatch('dist/styles.bundle.css', | ||
| /div\s*{\s*background:\s*url\(more.svg\);\s*}/)) |
There was a problem hiding this comment.
Can you confirm the path here? If I get the issue correctly, this test would pass even without your fixe since it's just checks that there is an url that has more.svg.
There was a problem hiding this comment.
Without my fix, when we add --deploy-url=client/, the result is:
div { background: url(client/more.svg); }
Test will fail in this case.
| .then(() => ng('build')) | ||
| .then(() => expectFileToMatch('dist/styles.bundle.css', | ||
| /div\s*{\s*background:\s*url\(more.svg\);\s*}/)) | ||
| .then(() => ng('build', '--prod')) |
There was a problem hiding this comment.
No need to test the prod builds, it shouldn't change anything regarding --extract-css.
| .then(() => ng('build', '--deploy-url=client/')) | ||
| .then(() => expectFileToMatch('dist/styles.bundle.css', | ||
| /div\s*{\s*background:\s*url\(more.svg\);\s*}/)) | ||
| .then(() => ng('build', '--prod', '--deploy-url=client/')) |
There was a problem hiding this comment.
No need for prod test, see above.
| .then((stylesBundle) => expectFileToMatch(stylesBundle, | ||
| /div\s*{\s*background:\s*url\(more\..*svg\)\s*}/)) | ||
| // build with deloyUrl | ||
| .then(() => ng('build', '--deploy-url=client/')) |
There was a problem hiding this comment.
Can you force --extract-css here just to be more explicit to the next person editing this test?
19efaa1 to
1a677c4
Compare
|
Thanks for this fix @changLiuUNSW! |
|
I'm having an issue which relates to this issue I think (paths replaced). The project was initialised with a a previous version of angular-cli Error: No errors |
|
Thank you @intellix! |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
All our CSS assets are in a flat structure in the
distfolder, therefore all relative URLs are simply./[asset name]Unfortunately, if we add
publicPathviadeployUrl,ExtractTextPluginpicks up theoutput.publicPathand rewrites assetsurlpath with[publicPath]/[asset name]fixes #4035