-
-
Notifications
You must be signed in to change notification settings - Fork 27k
main.js file contains html code instead of javascript Functions #4260
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
Comments
It's hard to help you without more information. Please fill out the issue template and provide your package.json file. |
Hi @iansu, I have read the issue template, rimraffed my files and still am having this issue. My package.json is :
This is error is a pain to reproduce because it has to do with cache invalidation in production. I have read and tried to understand these links for background: I have added the I have been unable to reproduce locally, but I could really use help. I don't want to have to unregister our serviceWorker, but it is looking like that may have to be the fix. |
It looks like this is a duplication of #3882 (comment) |
+1 It's not a duplication as we are getting a 200 not a 404 as that thread, but it seems express.js is asking for text/html content type for both main.js and main.css, and so the app never renders. I'm attaching a screenshot of my console in the hopes that someone sees something obvious I'm completely missing. The url is exactly what it should be, and the app renders fine when running on development mode running node.js as the back end, but for some reason when the build script is run something breaks. |
You can try to reproduce by generating SSL certs locally? Otherwise service workers won't be used. |
Hi! We're not providing support for Service Workers because we're no longer suggesting that anyone use them until they're a more stable spec. Please remove their usage for the time being -- really sorry about this! |
@Timer, I know you're not supporting service workers, but the sw precache plugin + service worker registration logic is still in the code, so maybe the issue can be kept open? There has been no work to actually solve or document the problem at the source, which is that main.js over 2mb doesnt get added to the precache plugin. |
Hi,
When I try to build the CRA in a node server, the main.js contains HTML code, thus I get the error.
Uncaught SyntaxError: Unexpected token <
I also dont see all the node modules generated into the static/js folder of the build.
When I deploy on the localhost it works as expected.
Also, another project is working as expected.
I see that react-script package.json is different between these 2 project.
I've tried deleting all the node_modules folders and I have the same error.
Also, I've tried using the same version of the package.json object and there is no success.
Thanks in advance.
The text was updated successfully, but these errors were encountered: