flareact icon indicating copy to clipboard operation
flareact copied to clipboard

JS files in public folder evaluated after copy and upload

Open traffisco opened this issue 4 years ago • 1 comments

Describe the problem:

Files with JS extension in the public folder are evaluated on yarn deploy. The folder intended for static files to be uploaded and scripts shouldn't be evaluated.

Link to a minimal reproduction:

https://github.com/traffisco/yarn-bug-test

Added new file test.js with "error" typed in it.

yarn deploy fails with error: "message": "Uncaught ReferenceError: error is not defined\n at line 22\n"

Files do get copied to out folder and uploaded to KV. Instant workaround is to delete the files from the public folder.

traffisco avatar Jan 07 '21 17:01 traffisco

Looks like wrangler publish have a bug with webpack CopyPlugin https://github.com/flareact/flareact/blob/0d0a8362e754330f21a6235150531d997f487ffd/configs/webpack.worker.config.js#L32 Quick fix is to move file copy from webpack to another place like https://github.com/flareact/flareact/blob/0d0a8362e754330f21a6235150531d997f487ffd/src/bin/flareact.js#L93

I can make a PR if you interested

traffisco avatar Jan 09 '21 16:01 traffisco