Skip to content

How, exactly, do modules work in parcel (v2)? #5377

Answered by devongovett
john01dav asked this question in Q&A
Discussion options

You must be logged in to vote

I replied on your other issue as well, but wanted to help explain a couple thing you saw here as well. I explained the need for assigning to the global scope manually there.

Your other attempt at using ES module syntax, was a simple mistake with a possibly confusing error. export function myFunction exports a function called myFunction, but import myFunction from "./assets/myfunction.js" imports the default import from that module. Either the named import syntax import {myFunction} from "./assets/myfunction.js" or the default export syntax export default function myFunction` would have worked, they just weren't matching up quite right.

As for documentation, it's always ripe for improvemen…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@john01dav
Comment options

Answer selected by john01dav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants