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

[heft] Create a Webpack 5 plugin. #2594

Merged
merged 8 commits into from
Apr 8, 2021

Conversation

iclanton
Copy link
Member

@iclanton iclanton commented Apr 7, 2021

Summary

This PR creates a Heft plugin to support Webpack 5.

Details

See #2586

How it was tested

Created a Webpack 5 test project that builds correctly and runs correctly with heft start.

'https://rushstack.io/pages/heft_tasks/webpack/'
'"@rushstack/heft-webpack4-plugin" or "@rushstack/heft-webpack5-plugin" to ' +
'your package.json devDependencies and use config/heft.json to load it. ' +
'For details, see this documentation: https://rushstack.io/pages/heft_tasks/webpack/'
Copy link
Collaborator

@octogonz octogonz Apr 8, 2021

Choose a reason for hiding this comment

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

Just curious -- what would happen if someone accidentally loaded BOTH plugins? (For example the project loads Webpack 4 but the rig loads Webpack 5)

Copy link
Member Author

Choose a reason for hiding this comment

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

You'll get a A plugin with name "WebpackPlugin" has already been applied error. We can eventually clean that error up, but I wouldn't consider that a high priority.

@iclanton iclanton force-pushed the ianc/webpack5-plugin branch 2 times, most recently from 9cfefed to 02309c1 Compare April 8, 2021 07:27
@iclanton iclanton force-pushed the ianc/webpack5-plugin branch from 02309c1 to 4f7bc3e Compare April 8, 2021 18:56
@iclanton iclanton enabled auto-merge April 8, 2021 18:57
@iclanton iclanton force-pushed the ianc/webpack5-plugin branch from 4f7bc3e to eccdf31 Compare April 8, 2021 20:09
@iclanton iclanton force-pushed the ianc/webpack5-plugin branch from eccdf31 to 0226482 Compare April 8, 2021 20:19
@iclanton iclanton merged commit 27ecc6a into microsoft:master Apr 8, 2021
@iclanton iclanton deleted the ianc/webpack5-plugin branch April 8, 2021 20:30
new Error(
`The Webpack plugin expected to be configured with webpack-dev-server version ${webpackVersions.webpackDevServerVersion}, ` +
`but the configuration specifies version ${bundleSubstageProperties.webpackDevServerVersion}. ` +
'Are multiple versions of the Webpack plugin present?'
Copy link
Contributor

Choose a reason for hiding this comment

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

Multiple versions of the webpack plugin should be an allowed scenario and may well be something a developer would want to do, hence why "configureWebpack" should be a hook on the webpack plugin instance, or on an "IWebpackPluginHooks" object, obtained by WebpackPlugin.getHooks(heftSession), not on the bundle substage.

Copy link
Contributor

@scamden scamden Apr 13, 2021

Choose a reason for hiding this comment

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

i'm super curious what the use case is for multiple webpack versions?

Copy link
Contributor

Choose a reason for hiding this comment

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

Backwards compatibility is the main reason I can think of. Building both so that you can compare the outputs between the two side by side, especially during upgrade.

Copy link
Contributor

Choose a reason for hiding this comment

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

very interesting. i would have never considered :) perhaps i should have during this last upgrade haha

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

Successfully merging this pull request may close these issues.

4 participants