webpack: Fix node_modules path resolution.

Webpack applies special logic to relative paths provided in
`resolve.modules`, and this logic is expected to be used for
`node_modules`.  One case where this is important is when
`node_modules/foo` wants to import a different version of package
`bar` than the one at `node_modules/bar`, and so yarn gives it its own
copy at `node_modules/foo/node_modules/bar`.

It would probably be better to avoid screwing with `resolve.modules`
at all, but this at least brings us one step closer to the default of
just `["node_modules"]`.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-04-21 22:47:05 -07:00 committed by Tim Abbott
parent fba3f49a9a
commit dd3ccbc897
1 changed files with 1 additions and 1 deletions

View File

@ -93,7 +93,7 @@ export default (env?: string): webpack.Configuration => {
resolve: { resolve: {
modules: [ modules: [
resolve(__dirname, "../static"), resolve(__dirname, "../static"),
resolve(__dirname, "../node_modules"), "node_modules",
resolve(__dirname, "../"), resolve(__dirname, "../"),
], ],
extensions: [".tsx", ".ts", ".js", ".json", ".scss", ".css"], extensions: [".tsx", ".ts", ".js", ".json", ".scss", ".css"],