-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
Switch from Cloudflare Pages to Workers with Static Assets #989
Switch from Cloudflare Pages to Workers with Static Assets #989
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
const srcPath = path.join(srcDir, file.name); | ||
const destPath = path.join(destDir, file.name); | ||
if (file.isDirectory()) { | ||
mkdirSync(destPath, { recursive: true }); |
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.
does this recursive option work on node 18? it might have been with another function call but I think we saw that this got added in node 20 for something else, so it seems good to double check.
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.
https://nodejs.org/docs/latest-v18.x/api/fs.html#fsmkdirsyncpath-options
Seems OK with 18.
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.
I think it is readdir's recursive option that isn't consistent across node versions. I think mkdir recursive is more stable.
copyFiles(assetsDistDir, workerPublicDir, [ | ||
'.txt', | ||
'.html', | ||
'.json', | ||
'.js', | ||
'.css', | ||
]); |
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.
would this break if there were files like a CNAME of favicon?
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.
I don't think so. The purpose of this is to copy built public assets that might imported during SSR.
It would be better if we had a manifest of these files to copy rather than making assumptions by file extension.
@rmarscher Please check the CI error. It fails on Windows. |
I see. Hmm... maybe it needs to get an OS temp dir.
|
Fixes #944