Skip to content
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

Merged

Conversation

rmarscher
Copy link
Contributor

Fixes #944

Copy link

vercel bot commented Nov 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
waku ✅ Ready (Inspect) Visit Preview Nov 6, 2024 7:22pm

Copy link

codesandbox-ci bot commented Nov 6, 2024

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 });
Copy link
Contributor

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.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@rmarscher rmarscher Nov 6, 2024

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.

Comment on lines 154 to 160
copyFiles(assetsDistDir, workerPublicDir, [
'.txt',
'.html',
'.json',
'.js',
'.css',
]);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@dai-shi dai-shi mentioned this pull request Nov 6, 2024
@dai-shi
Copy link
Owner

dai-shi commented Nov 6, 2024

@rmarscher Please check the CI error. It fails on Windows.

@rmarscher
Copy link
Contributor Author

@rmarscher Please check the CI error. It fails on Windows.

I see. Hmm... maybe it needs to get an OS temp dir.

EPERM: operation not permitted, rename 'D:\a\waku\waku\examples\31_minimal\dist' -> 'D:\a\waku\waku\examples\31_minimal\_dist'

@dai-shi dai-shi merged commit 2037f4d into dai-shi:main Nov 7, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch back to Cloudflare Workers
3 participants