Skip to content

fix(plugin-webpack): ESM-compatible imports#4206

Merged
erickzhao merged 2 commits intonextfrom
fix/webpack
Apr 9, 2026
Merged

fix(plugin-webpack): ESM-compatible imports#4206
erickzhao merged 2 commits intonextfrom
fix/webpack

Conversation

@erickzhao
Copy link
Copy Markdown
Member

ESM interop fails us at times when consuming CommonJS modules. This upstreams a patch from electron/fiddle#1878 and adds a regression test to test-dist.ts to ensure that all modules without side effects are importable.

@erickzhao erickzhao requested a review from a team as a code owner April 8, 2026 21:26
@github-actions github-actions bot added the next label Apr 8, 2026
import HtmlWebpackPlugin from 'html-webpack-plugin';
import * as webpack from 'webpack';
import { DefinePlugin, ExternalsPlugin, WebpackPluginInstance } from 'webpack';
import type * as webpack from 'webpack';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit(non-blocking): since we only need WebpackPluginInstance, could this just be import type { WebpackPluginInstance } from 'webpack';?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This isn't in the diff but there are a handful of other types we were using beforehand (Configuration, Entry, etc.)

@erickzhao erickzhao requested a review from dsanders11 April 8, 2026 22:58
@erickzhao
Copy link
Copy Markdown
Member Author

Need a re-approval. Added 9f0e1a0 because of an oversight (can't use the same code path to import() on win32).

@erickzhao erickzhao merged commit 8717867 into next Apr 9, 2026
12 checks passed
@erickzhao erickzhao deleted the fix/webpack branch April 9, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants