From bd2526b375ed4927f64af6cd426556a05e0c311d Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Mon, 16 Aug 2021 15:21:28 -0700 Subject: [PATCH] fix(template-webpack): only use node-loader if the .node files are in native_modules/ (#2449) --- packages/template/typescript-webpack/tmpl/webpack.rules.js | 4 +++- packages/template/webpack/tmpl/webpack.rules.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/template/typescript-webpack/tmpl/webpack.rules.js b/packages/template/typescript-webpack/tmpl/webpack.rules.js index 8069b8e3dd..e85ade6592 100644 --- a/packages/template/typescript-webpack/tmpl/webpack.rules.js +++ b/packages/template/typescript-webpack/tmpl/webpack.rules.js @@ -1,7 +1,9 @@ module.exports = [ // Add support for native node modules { - test: /\.node$/, + // We're specifying native_modules in the test because the asset relocator loader generates a + // "fake" .node file which is really a cjs file. + test: /native_modules\/.+\.node$/, use: 'node-loader', }, { diff --git a/packages/template/webpack/tmpl/webpack.rules.js b/packages/template/webpack/tmpl/webpack.rules.js index 219bb313e7..66bc18f941 100644 --- a/packages/template/webpack/tmpl/webpack.rules.js +++ b/packages/template/webpack/tmpl/webpack.rules.js @@ -1,7 +1,9 @@ module.exports = [ // Add support for native node modules { - test: /\.node$/, + // We're specifying native_modules in the test because the asset relocator loader generates a + // "fake" .node file which is really a cjs file. + test: /native_modules\/.+\.node$/, use: 'node-loader', }, {