From 9c112b208b031238d395b076834d8813cf70ecf4 Mon Sep 17 00:00:00 2001 From: tiddlygit-test Date: Tue, 4 May 2021 13:29:10 +0800 Subject: [PATCH] fix: only use @zeit/webpack-asset-relocator-loader for main process fixes https://github.com/vercel/webpack-asset-relocator-loader/issues/97 --- webpack.main.config.js | 15 ++++++++++++++- webpack.rules.js | 11 ----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/webpack.main.config.js b/webpack.main.config.js index 98423e31e..02379d5f9 100644 --- a/webpack.main.config.js +++ b/webpack.main.config.js @@ -11,7 +11,20 @@ module.exports = { entry: './src/main.ts', // Put your normal webpack config below here module: { - rules: require('./webpack.rules'), + rules: [ + ...require('./webpack.rules'), + { + test: /\.(m?js|node)$/, + parser: { amd: true }, + use: { + loader: '@zeit/webpack-asset-relocator-loader', + options: { + outputAssetBase: 'native_modules', + emitDirnameAll: true, + }, + }, + }, + ], }, plugins: plugins.main, resolve: { diff --git a/webpack.rules.js b/webpack.rules.js index 072a87ccd..c5c6e49fd 100644 --- a/webpack.rules.js +++ b/webpack.rules.js @@ -16,17 +16,6 @@ module.exports = [ test: /\.node$/, use: 'node-loader', }, - { - test: /\.(m?js|node)$/, - parser: { amd: true }, - use: { - loader: '@zeit/webpack-asset-relocator-loader', - options: { - outputAssetBase: 'native_modules', - emitDirnameAll: true, - }, - }, - }, { // used to load css from npm package, we use styled-components test: /\.css$/,