fix: don't externalize node built-ins

This commit is contained in:
Igor Randjelovic
2021-04-14 14:58:44 +02:00
parent 0f5b127c1a
commit f053403d8d
8 changed files with 57 additions and 0 deletions

View File

@ -7,6 +7,9 @@ exports[`angular configuration for android 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {
@ -352,6 +355,9 @@ exports[`angular configuration for ios 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {

View File

@ -7,6 +7,9 @@ exports[`base configuration for android 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {
@ -297,6 +300,9 @@ exports[`base configuration for ios 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {

View File

@ -7,6 +7,9 @@ exports[`javascript configuration for android 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {
@ -335,6 +338,9 @@ exports[`javascript configuration for ios 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {

View File

@ -7,6 +7,9 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {
@ -325,6 +328,9 @@ exports[`react configuration > android > base config 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {
@ -621,6 +627,9 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {
@ -940,6 +949,9 @@ exports[`react configuration > ios > base config 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {

View File

@ -7,6 +7,9 @@ exports[`svelte configuration for android 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {
@ -322,6 +325,9 @@ exports[`svelte configuration for ios 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {

View File

@ -7,6 +7,9 @@ exports[`typescript configuration for android 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {
@ -335,6 +338,9 @@ exports[`typescript configuration for ios 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {

View File

@ -7,6 +7,9 @@ exports[`vue configuration for android 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {
@ -329,6 +332,9 @@ exports[`vue configuration for ios 1`] = `
'package.json', 'package.json',
'~/package.json' '~/package.json'
], ],
externalsPresets: {
node: false
},
devtool: 'inline-source-map', devtool: 'inline-source-map',
target: 'node', target: 'node',
watchOptions: { watchOptions: {

View File

@ -44,6 +44,15 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
// resolved at runtime // resolved at runtime
config.externals(['package.json', '~/package.json']); config.externals(['package.json', '~/package.json']);
// disable marking built-in node modules as external
// since they are not available at runtime and
// should be bundled (requires polyfills)
// for example `npm i --save url` to
// polyfill the node url module.
config.set('externalsPresets', {
node: false,
});
const getSourceMapType = (map: string | boolean): Config.DevTool => { const getSourceMapType = (map: string | boolean): Config.DevTool => {
const defaultSourceMap = 'inline-source-map'; const defaultSourceMap = 'inline-source-map';