From 047c6850c618172a7593b340d4f48b266d8f56e3 Mon Sep 17 00:00:00 2001 From: Jean Helou Date: Tue, 26 May 2020 17:52:55 +0200 Subject: [PATCH] (OK) fixes webpack alias to be relative to node_modules --- packages/web-app/next.config.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/web-app/next.config.js b/packages/web-app/next.config.js index 6a0642b..dc73f76 100644 --- a/packages/web-app/next.config.js +++ b/packages/web-app/next.config.js @@ -2,11 +2,24 @@ // https://www.npmjs.com/package/next-transpile-modules const withTM = require("next-transpile-modules")(["bar"]); +const path = require("path"); + const nextConfig = { webpack: function (config) { + /* + Optionnaly, adding the following to modules + will resolve modules using relative paths instead of + going through `/node_modules` + */ + /* + config.resolve.modules = [ + path.join(__dirname, ".."), + ...config.resolve.modules, + ]; + */ config.resolve.alias = { ...config.resolve.alias, - baz: "../baz/src", + baz: "baz/src", }; return config;