mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 23:37:18 +00:00
fix(webpack): don't rewrite import paths inside node_modules (#2195)
We ensure that paths inside node_modules files are kept untouched, as currently the RegExp can match 'shared' folders inside those and rewrite paths, breaking them. Change-Type: patch
This commit is contained in:
parent
262d06f035
commit
1b30dab8eb
@ -34,6 +34,16 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
externals: [
|
externals: [
|
||||||
(context, request, callback) => {
|
(context, request, callback) => {
|
||||||
|
// eslint-disable-next-line lodash/prefer-lodash-method
|
||||||
|
const absoluteContext = path.resolve(context)
|
||||||
|
const absoluteNodeModules = path.resolve('node_modules')
|
||||||
|
|
||||||
|
// We shouldn't rewrite any node_modules import paths
|
||||||
|
// eslint-disable-next-line lodash/prefer-lodash-method
|
||||||
|
if (!path.relative(absoluteNodeModules, absoluteContext).startsWith('..')) {
|
||||||
|
return callback()
|
||||||
|
}
|
||||||
|
|
||||||
// We want to keep the SDK code outside the GUI bundle.
|
// We want to keep the SDK code outside the GUI bundle.
|
||||||
// This piece of code allows us to run the GUI directly
|
// This piece of code allows us to run the GUI directly
|
||||||
// on the tree (for testing purposes) or inside a generated
|
// on the tree (for testing purposes) or inside a generated
|
||||||
|
Loading…
x
Reference in New Issue
Block a user