mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
fix: load globals first
This commit is contained in:
@ -21,8 +21,9 @@ export default function (config: Config, env: IWebpackEnv): Config {
|
||||
config.mode(mode);
|
||||
|
||||
// package.json is generated by the CLI with runtime options
|
||||
// this ensures it's not included in the bundle
|
||||
config.externals(['package.json']);
|
||||
// this ensures it's not included in the bundle, but rather
|
||||
// resolved at runtime
|
||||
config.externals(['package.json', '~/package.json']);
|
||||
|
||||
// todo: devtool
|
||||
config.devtool('inline-source-map');
|
||||
@ -32,7 +33,18 @@ export default function (config: Config, env: IWebpackEnv): Config {
|
||||
// appears to be working - but we still have to deal with HMR
|
||||
config.target('node');
|
||||
|
||||
config.entry('bundle').add(entryPath);
|
||||
config
|
||||
.entry('bundle')
|
||||
// ensure we load nativescript globals first
|
||||
.add('@nativescript/core/globals/index.js')
|
||||
.add(entryPath);
|
||||
|
||||
// inspector_modules
|
||||
config.when(shouldIncludeInspectorModules(env), (config) => {
|
||||
config
|
||||
.entry('tns_modules/@nativescript/core/inspector_modules')
|
||||
.add('@nativescript/core/inspector_modules');
|
||||
});
|
||||
|
||||
config.output
|
||||
.path(getAbsoluteDistPath())
|
||||
@ -74,13 +86,6 @@ export default function (config: Config, env: IWebpackEnv): Config {
|
||||
.add('node_modules/@nativescript/webpack/dist/loaders')
|
||||
.add('node_modules');
|
||||
|
||||
// inspector_modules
|
||||
config.when(shouldIncludeInspectorModules(env), (config) => {
|
||||
config
|
||||
.entry('tns_modules/@nativescript/core/inspector_modules')
|
||||
.add('@nativescript/core/inspector_modules');
|
||||
});
|
||||
|
||||
config.resolve.extensions
|
||||
.add(`.${platform}.ts`)
|
||||
.add('.ts')
|
||||
@ -95,7 +100,6 @@ export default function (config: Config, env: IWebpackEnv): Config {
|
||||
|
||||
// base aliases
|
||||
config.resolve.alias
|
||||
.set('~/package.json', 'package.json')
|
||||
.set('~', '<TODO>appFullPath')
|
||||
.set('@', '<TODO>appFullPath');
|
||||
|
||||
|
Reference in New Issue
Block a user