-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
fix(core): explicitly define CopyWebpackPlugin toType: 'dir' #8481
fix(core): explicitly define CopyWebpackPlugin toType: 'dir' #8481
Conversation
Hi @Thomascogez! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of this PR
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Could you add a static directory in our own website with brackets in its path, and compare the build results on main vs. on this branch? (Maybe also test if this fixes #8135 by adding another static directory with dots?) Also, could you illuminate me about why your fix works? |
After intense local testing, I was able to determine that the point of failure was during webpack build, more especially when
After that some fs operation are run based on the determined type of input, in this case it's running fs operation targeting a file that why Hope it's clear 😅 |
Makes sense, thanks :) Could you add two test directories under |
I tested locally to reproduce #8135 and it build successfully with this fix 👍. |
I misspoke in my first edit,
but edited to:
Should my tests be under _dogfooding since it's the outDir causing the issue ? I'm still exploring the project and the folder structure of the tests |
If the dots issue can't be reproduced with a subdirectory of |
It's actually the So static subfolder with bracket or dots are actually building. Here my tests: Main branchBracketWithout --out-dir arg
yarn build output: [ERROR] Error: EISDIR: illegal operation on a directory, open '/Users/thomascogez--allix/Documents/dev/personnal/docusaurus-bracket-in-path-bug-repro/[bracket]/build'
[ERROR] Unable to build website for locale en.
[ERROR] Error: EISDIR: illegal operation on a directory, open '/Users/thomascogez--allix/Documents/dev/personnal/docusaurus-bracket-in-path-bug-repro/[bracket]/build' With --out-dir arg
yarn build --out-dir "build/[bracket]" output: [ERROR] Error: EISDIR: illegal operation on a directory, open '/Users/thomascogez--allix/Documents/dev/personnal/docusaurus-bracket-in-path-bug-repro/[bracket]/build/[bracket]'
[ERROR] Unable to build website for locale en.
[ERROR] Error: EISDIR: illegal operation on a directory, open '/Users/thomascogez--allix/Documents/dev/personnal/docusaurus-bracket-in-path-bug-repro/[bracket]/build/[bracket]' DotWithout --out-dir arg
yarn build output: [SUCCESS] Generated static files in "build".
[INFO] Use `npm run serve` command to test your build locally. With --out-dir arg
yarn build --out-dir "build/6.0" output: [ERROR] Error: EISDIR: illegal operation on a directory, open '/Users/thomascogez--allix/Documents/dev/personnal/docusaurus-bracket-in-path-bug-repro/6.0/build/6.0'
[ERROR] Unable to build website for locale en.
[ERROR] Error: EISDIR: illegal operation on a directory, open '/Users/thomascogez--allix/Documents/dev/personnal/docusaurus-bracket-in-path-bug-repro/6.0/build/6.0' Fix branchBracketWithout --out-dir arg
yarn build output: [SUCCESS] Generated static files in "build".
[INFO] Use `npm run serve` command to test your build locally. With --out-dir arg
yarn build --out-dir "build/[bracket]" output: [SUCCESS] Generated static files in "build/[bracket]".
[INFO] Use `npm run serve` command to test your build locally. DotWithout --out-dir arg
yarn build output: [SUCCESS] Generated static files in "build".
[INFO] Use `npm run serve` command to test your build locally. With --out-dir arg
yarn build --out-dir "build/6.0" output: [SUCCESS] Generated static files in "build/6.0".
[INFO] Use `npm run serve` command to test your build locally. |
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.
Sounds fair :)
Great ! Thanks for your time 👍 |
LGTM thanks ;) |
Note
Since it's my first PR here, I am not sure about the process.
And we be pleased to have some guidance.
Pre-flight checklist
--out-dir
includes dot in path segment #8135) and the maintainers have approved on my working plan.Motivation
I have a project where the convention is using bracket [] in folder name.
The actual version of docusaurus if failing at build stage when there is a folder with bracket in the name.
What I did
After some investigation, I found that the issue is coming from the
copy-webpack-plugin
.It actually report the folder has a file.
Here the actual config
Proposed change
Since outDir is of course always a dir we can set the
toType
option todir
to solve this issue, this actually solve the false report of the outdir has a file bycopy-webpack-plugin
Test Plan
I will need some guidance for this part as I am not sure how to test this change.
Test links
Bug reproduction: https://github.com/Thomascogez/docusaurus-bracket-in-path-bug-repro
Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/
Related issues/PRs
#8480