fix bundle-config-loader order

# Conflicts:
#	packages/core/globals/index.ts
This commit is contained in:
Martin Guillon
2020-09-09 23:09:30 +02:00
parent 8bc5abe01b
commit 02d4f4bc2f
7 changed files with 8 additions and 20 deletions

View File

@ -1,8 +1,5 @@
// Require globals first so that snapshot takes __extends function. // Require globals first so that snapshot takes __extends function.
const nsGlobals = require('../globals'); import '../globals';
if (!global.NativeScriptHasInitGlobal) {
nsGlobals.initGlobal();
}
// Types // Types
import { AndroidApplication, iOSApplication } from '.'; import { AndroidApplication, iOSApplication } from '.';

View File

@ -1,5 +1,5 @@
const g = require('./globals'); // using import is important to ensure webpack keep it in order
g.initGlobal(); import './globals';
// Register "dynamically" loaded module that need to be resolved by the // Register "dynamically" loaded module that need to be resolved by the
// XML/component builders. // XML/component builders.

View File

@ -360,4 +360,4 @@ export function initGlobal() {
} }
if (!global.NativeScriptHasInitGlobal) { if (!global.NativeScriptHasInitGlobal) {
initGlobal(); initGlobal();
} }

View File

@ -1,7 +1,6 @@
/// <reference path="./global-types.d.ts" /> /// <reference path="./global-types.d.ts" />
// Init globals first (use require to ensure it's always at the top) // Init globals first (use require to ensure it's always at the top)
const nsGlobals = require('./globals'); import '../globals';
nsGlobals.initGlobal();
export { iOSApplication, AndroidApplication } from './application'; export { iOSApplication, AndroidApplication } from './application';
export type { ApplicationEventData, LaunchEventData, OrientationChangedEventData, UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData, AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, AndroidActivityNewIntentEventData, AndroidActivityBackPressedEventData, SystemAppearanceChangedEventData } from './application'; export type { ApplicationEventData, LaunchEventData, OrientationChangedEventData, UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData, AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, AndroidActivityNewIntentEventData, AndroidActivityBackPressedEventData, SystemAppearanceChangedEventData } from './application';

View File

@ -1,8 +1,5 @@
console.log('Loading inspector modules...'); console.log('Loading inspector modules...');
import { initGlobal } from './globals'; import './globals';
if (!global.NativeScriptHasInitGlobal) {
initGlobal();
}
require('./debugger/webinspector-network'); require('./debugger/webinspector-network');
require('./debugger/webinspector-dom'); require('./debugger/webinspector-dom');
require('./debugger/webinspector-css'); require('./debugger/webinspector-css');

View File

@ -1,12 +1,7 @@
import '../../globals';
import { setActivityCallbacks, AndroidActivityCallbacks } from '.'; import { setActivityCallbacks, AndroidActivityCallbacks } from '.';
// use requires to ensure import order
const globals = require('../../globals');
const appModule = require('../../application'); const appModule = require('../../application');
if (global.__snapshot) {
globals.initGlobal();
}
/** /**
* NOTE: We cannot use NativeClass here because this is used in appComponents in webpack.config * NOTE: We cannot use NativeClass here because this is used in appComponents in webpack.config
* Whereby it bypasses the decorator transformation, hence pure es5 style written here * Whereby it bypasses the decorator transformation, hence pure es5 style written here

View File

@ -52,7 +52,7 @@ const loader: loader.Loader = function (source, map) {
} }
source = ` source = `
require("${sourceModule}/bundle-entry-points"); import "${sourceModule}/bundle-entry-points";
${source} ${source}
`; `;