Skip to content
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

How are different module systems being used together? #1670

Closed
ugultopu opened this issue Oct 24, 2017 · 1 comment
Closed

How are different module systems being used together? #1670

ugultopu opened this issue Oct 24, 2017 · 1 comment
Assignees

Comments

@ugultopu
Copy link

ugultopu commented Oct 24, 2017

I couldn't find an explanation for this anywhere: Not in the docs, not on the web, anywhere.

For example, the official getting started guide uses Lodash as an example library to import. The guide imports the library using the ES6 module syntax.

However, as of now, Lodash uses CommonJS module system to export stuff. I cannot understand how can webpack import stuff using ES6 module syntax from a module written in CommonJS syntax.

Had we used Babel, I would say that Babel is first transpiling the ES6 module syntax to CommonJS module syntax and hence, webpack is easily using these two different module syntaxes together, thanks to Babel.

Is webpack doing the same thing behind the scenes? Or is it doing something else? In any case, where can I find further information on it?

@skipjack
Copy link
Collaborator

Please see my comment to your original question on #552.

Is webpack doing the same thing behind the scenes? Or is it doing something else? In any case, where can I find further information on it?

The short answer is yes, webpack supports multiple syntaxes out of the box. See that comment for links to the pages that discuss which ones are supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants