Skip to content
Advertisement

ESMs are always file-based

ES Modules

First, there’s no wrapping function to define a module. The
wrapping context is a file. ESMs are always file-based; one
file, one module.

I found this sentence from “you don’t know js by kyle simpson”.What is he meant by ESMs are always file-based; one file, one module.Does that mean one java script file can only contains one module

Advertisement

Answer

Does that mean one java script file can only contains one module

Yes. Every JavaScript module file contains exactly one module. You can’t have a module file with more than one module in it.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement