From 0abeda35284b84e49780aeca6e0df3fcfaafb737 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 12 Oct 2021 06:26:17 +0200 Subject: [PATCH] webpack: Use default resolve path for npm 7 compatibility npm 7 changed how it resolves dependencies, and starter-kit fails to build with lots of unresolved peer dependencies of PatternFly. With an absolute path, `resolve.modules` will only look in that directory; the default is a relative path "node_modules" that just works [1]. Use that default, as we don't use `$SRCDIR` in this project anyway. [1] https://webpack.js.org/configuration/resolve/#resolvemodules --- webpack.config.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 0cc78d3..600e5ee 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -15,8 +15,6 @@ crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sh const webpack = require("webpack"); -const nodedir = path.resolve((process.env.SRCDIR || __dirname), "node_modules"); - /* A standard nodejs and webpack pattern */ const production = process.env.NODE_ENV === 'production'; @@ -44,11 +42,11 @@ if (production) { module.exports = { mode: production ? 'production' : 'development', resolve: { - modules: [ nodedir, path.resolve(__dirname, 'src/lib') ], - alias: { 'font-awesome': path.resolve(nodedir, 'font-awesome-sass/assets/stylesheets') }, + modules: [ "node_modules", path.resolve(__dirname, 'src/lib') ], + alias: { 'font-awesome': 'font-awesome-sass/assets/stylesheets' }, }, resolveLoader: { - modules: [ nodedir, path.resolve(__dirname, 'src/lib') ], + modules: [ "node_modules", path.resolve(__dirname, 'src/lib') ], }, watchOptions: { ignored: /node_modules/,