Skip to content

Commit

Permalink
Add relative 'node_modules' to webpack resolve paths
Browse files Browse the repository at this point in the history
When only an absolute path is provided, webpack does not do the
normal node-like bubbling up when looking for modules.

This is a problem when a library has a nested node_modules
directory with a dependency which has a different version than
the dependency in the top-level node_modules.

https://webpack.js.org/configuration/resolve/#resolvemodules
  • Loading branch information
tomasr8 authored and ThiefMaster committed Nov 24, 2022
1 parent 3986a26 commit 18855f9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions webpack/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ export function webpackDefaults(env, config, bundles, isPlugin = false) {
const globalBuildConfig = config.indico ? config.indico.build : config.build;
const currentEnv = (env ? env.NODE_ENV : null) || 'development';
const nodeModules = [
// Pass relative 'node_modules' first, so that nested node_modules are checked first.
// https://webpack.js.org/configuration/resolve/#resolvemodules
'node_modules',
path.join(
config.build.indicoSourcePath || path.resolve(config.build.rootPath, '..'),
'node_modules'
Expand Down

0 comments on commit 18855f9

Please sign in to comment.