Skip to content

docs(plugins): Clarify the case of ModuleConcatenationPlugin + Babel #1766

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

Merged
merged 2 commits into from
Jan 17, 2018

Conversation

jrencz
Copy link
Contributor

@jrencz jrencz commented Dec 29, 2017

Adds more information about why the plugin may cause no effect in case Babel

Related:

Copy link
Collaborator

@skipjack skipjack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. I see where you're going with the added note but I think we can improve it a bit to clarify things. See my one comment.

@@ -19,6 +19,8 @@ new webpack.optimize.ModuleConcatenationPlugin()
>
> Scope hoisting is specifically a feature made possible by ECMAScript Module syntax. Because of this webpack may fallback to normal bundling based on what kind of modules you are using, and [other conditions](https://medium.com/webpack/webpack-freelancing-log-book-week-5-7-4764be3266f5).

**Note**: please keep in mind that this plugin will not affect the build in case ECMAScript modules are processed into either of supported module systems. E.g. Babel transforms ES Modules to commonjs by default (see: [Babel ES2015 Preset options: modules](https://babeljs.io/docs/plugins/preset-es2015/#optionsmodules)).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you're getting at but I would recommend tweaking this a bit and using our custom W> syntax, e.g.

W> Keep in mind that this plugin will only be applied to [ES6 modules](/api/module-methods/#es6-recommended-) processed directly by webpack. When using a transpiler, you'll need to disable module processing (e.g. the [`modules`](https://babeljs.io/docs/plugins/preset-es2015/#optionsmodules) option in Babel).

Adds more information about why the plugin may cause no effect in case Babel
@skipjack skipjack merged commit b1587e8 into webpack:master Jan 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants