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

Add plugin option. #22

Merged
merged 3 commits into from
May 29, 2020
Merged

Add plugin option. #22

merged 3 commits into from
May 29, 2020

Conversation

vseventer
Copy link
Contributor

@vseventer vseventer commented May 14, 2020

This Pull Request:

Adds a plugins option.

Why is this PR needed?

Child compilers don't inherit plugins from the root compiler. Therefore, it is currently not possible to implement things like externals in the spawned files. Rather than adding support for all internal Webpack plugins one-by-one, why not allow a plugin option instead?

Example usage with defining an external React, which will be excluded from the bundle and instead contains a module simply exporting window.react:

file.js

import React from 'react';

webpack.config.js

{
  loader: 'spawn-loader',
  options: {
    plugins: [new webpack.ExternalsPlugin('var', { react: 'React' })]
  }
}

@erikdesjardins erikdesjardins merged commit 4e09401 into erikdesjardins:master May 29, 2020
@erikdesjardins
Copy link
Owner

Released in 6.1.0, thanks!

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

Successfully merging this pull request may close these issues.

2 participants