Build error when using JS imports: Browser scripts cannot have imports or exports #6490
-
Hi everyone! I am using All of a sudden I am getting this error message from I tried everything from |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 23 replies
-
You need to add |
Beta Was this translation helpful? Give feedback.
-
I'm having the same issue with
(I also tried with the transformers at |
Beta Was this translation helpful? Give feedback.
-
Following the getting started
Makes encountering this error pretty quickly, I'd suggest to clarify that section so that new users won't encounter that error after writing their first statement in the |
Beta Was this translation helpful? Give feedback.
-
Maybe a bit unrelated... I'm not interested in the js script made as module, but the one for older browsers only. Is there a way to say: "just create the legacy script"? |
Beta Was this translation helpful? Give feedback.
-
Weird, but... Even if I declared type module (tried every combination, even both in index.html and package.json together) I get an error like guys above. |
Beta Was this translation helpful? Give feedback.
-
I`m trying to work p5 lib with typescript. Same error happening. |
Beta Was this translation helpful? Give feedback.
-
After pulling out my hair for a bit, I found the resolution for my variation of this problem: remove the Yes, I indeed had the "type" attribute twice. Once I removed the errant I hope this helps someone else. Also, it might be helpful if parcel detected such blunders. Parcel outputs the same recommendation to add |
Beta Was this translation helpful? Give feedback.
-
Using a transformer-raw transformer got me over this mountain. Hope that helps other people. |
Beta Was this translation helpful? Give feedback.
You need to add
type="module"
to your script tag. There should be an error message describing this but codeframes might be broke at the moment (see #6485).