make DEV_WEB_BUILDER_OMIT_SLOW_DEPS work with pnpm (#47067)

The DEV_WEB_BUILDER_OMIT_SLOW_DEPS env var is an experimental dev env var for faster builds that I sometimes use. When using it, the packageResolution plugin needs the same fix as the one for stylePlugin in https://github.com/sourcegraph/sourcegraph/pull/46452 to work with pnpm. This is a generally sensible fix that implements the correct and desirable behavior, not just a way to make a hack work.
This commit is contained in:
Quinn Slack 2023-01-29 00:40:20 -08:00 committed by GitHub
parent 4405a2c6ef
commit 316ccbac57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@ import fs from 'fs'
import { CachedInputFileSystem, ResolverFactory } from 'enhanced-resolve'
import * as esbuild from 'esbuild'
import { NODE_MODULES_PATH } from '../paths'
import { NODE_MODULES_PATH, WORKSPACE_NODE_MODULES_PATHS } from '../paths'
interface Resolutions {
[fromModule: string]: string
@ -22,7 +22,7 @@ export const packageResolutionPlugin = (resolutions: Resolutions): esbuild.Plugi
fileSystem: new CachedInputFileSystem(fs, 4000),
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
symlinks: true, // Resolve workspace symlinks
modules: [NODE_MODULES_PATH],
modules: [NODE_MODULES_PATH, ...WORKSPACE_NODE_MODULES_PATHS],
unsafeCache: true,
})