-
Notifications
You must be signed in to change notification settings - Fork 14
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
Let the developer decide: "import foo from 'foo.js'" means foo.js is a module #20
Comments
@backspaces BC means that you can write new modules using ESM, with the new syntax, and import from a module that might or might not be ESM :/, import statement is not a good signal for this. |
Does this mean that only the "main" or "top-level" module, the actual node script, needs to use .esm? I hope?! That's fine. I just want it to be able to import/export .js files. |
No, only ES6 module files need to use .esm (or whatever the extension is, if node.js decides to use a new extension for module files). |
Assuming node.js or a script bundler like Webpack Think of it like this:
Conversely, An entry script could be any of those. |
Thanks! |
OK, I know there are huge subtleties, but why not just assume the developer knows best and if an import is used, with a .js extension or some other, then just presume it's an es6 module?
Just treat any file using "import" as a module with the transitive closure of imports derived from the file. "import" means it's a module.
I'm sorry if this is naive, but I really don't want "Determining if source is an ES Module" to spiral down a never ending debate.
The text was updated successfully, but these errors were encountered: