From 72df4288ef246d8a82cddb65eac36bf21b23184e Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 4 Dec 2023 20:46:25 +0200 Subject: [PATCH] chore: webpack: apply webpack5 externals --- .putout.json | 1 - .webpack/js.js | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.putout.json b/.putout.json index 97b77d3d..fa70da30 100644 --- a/.putout.json +++ b/.putout.json @@ -7,7 +7,6 @@ "fontello.json" ], "rules": { - "webpack/apply-externals": "off", "github/convert-npm-to-bun": "off" }, "match": { diff --git a/.webpack/js.js b/.webpack/js.js index 53be8dc1..1353efdc 100644 --- a/.webpack/js.js +++ b/.webpack/js.js @@ -27,6 +27,7 @@ const notEmpty = (a) => a; const clean = (array) => array.filter(notEmpty); const noParse = (a) => /\.spec\.js$/.test(a); +const convertToWebpack5Externals = (fn) => (context, request, cb) => fn({context, request}, cb); const options = { babelrc: true, @@ -100,7 +101,7 @@ module.exports = { devtoolModuleFilenameTemplate, publicPath: '/dist/', }, - externals: [externals], + externals: [convertToWebpack5Externals(externals)], module: { rules, noParse, @@ -112,7 +113,7 @@ module.exports = { }, }; -function externals(context, request, fn) { +function externals({request}, fn) { if (!isDev) return fn();