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

Prevent unpredictable dependency hosting by explicitly resolve module path on webpack.ProvidePlugin #20971

Merged
merged 1 commit into from Jan 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions packages/next/build/webpack-config.ts
Expand Up @@ -911,14 +911,13 @@ export default async function getBaseWebpackConfig(
},
plugins: [
hasReactRefresh && new ReactRefreshWebpackPlugin(),
// Makes sure `Buffer` is polyfilled in client-side bundles (same behavior as webpack 4)
// Makes sure `Buffer` and `process` are polyfilled in client-side bundles (same behavior as webpack 4)
isWebpack5 &&
!isServer &&
new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] }),
// Makes sure `process` is polyfilled in client-side bundles (same behavior as webpack 4)
isWebpack5 &&
!isServer &&
new webpack.ProvidePlugin({ process: ['process'] }),
new webpack.ProvidePlugin({
Buffer: [require.resolve('buffer'), 'Buffer'],
process: [require.resolve('process')],
}),
// This plugin makes sure `output.filename` is used for entry chunks
!isWebpack5 && new ChunkNamesPlugin(),
new webpack.DefinePlugin({
Expand Down