Unverified Commit ccdcd3a6 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

restore webpack defaults for managed/immutablePaths (#25250)

Due to bundling of webpack the default values can't be correctly detected
This restores the webpack defaults
parent ea1cdb26
...@@ -1247,6 +1247,47 @@ export default async function getBaseWebpackConfig( ...@@ -1247,6 +1247,47 @@ export default async function getBaseWebpackConfig(
// webpack 5 no longer polyfills Node.js modules: // webpack 5 no longer polyfills Node.js modules:
if (webpackConfig.node) delete webpackConfig.node.setImmediate if (webpackConfig.node) delete webpackConfig.node.setImmediate
// Due to bundling of webpack the default values can't be correctly detected
// This restores the webpack defaults
// @ts-ignore webpack 5
webpackConfig.snapshot = {}
if (process.versions.pnp === '3') {
const match = /^(.+?)[\\/]cache[\\/]jest-worker-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec(
require.resolve('jest-worker')
)
if (match) {
// @ts-ignore webpack 5
webpackConfig.snapshot.managedPaths = [
path.resolve(match[1], 'unplugged'),
]
}
} else {
const match = /^(.+?[\\/]node_modules)[\\/]/.exec(
require.resolve('jest-worker')
)
if (match) {
// @ts-ignore webpack 5
webpackConfig.snapshot.managedPaths = [match[1]]
}
}
if (process.versions.pnp === '1') {
const match = /^(.+?[\\/]v4)[\\/]npm-jest-worker-[^\\/]+-[\da-f]{40}[\\/]node_modules[\\/]/.exec(
require.resolve('jest-worker')
)
if (match) {
// @ts-ignore webpack 5
webpackConfig.snapshot.immutablePaths = [match[1]]
}
} else if (process.versions.pnp === '3') {
const match = /^(.+?)[\\/]jest-worker-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec(
require.resolve('jest-worker')
)
if (match) {
// @ts-ignore webpack 5
webpackConfig.snapshot.immutablePaths = [match[1]]
}
}
if (dev) { if (dev) {
if (!webpackConfig.optimization) { if (!webpackConfig.optimization) {
webpackConfig.optimization = {} webpackConfig.optimization = {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment