Skip to content

Commit b344f63

Browse files
committed
feat: NativeScript v9 support
1 parent c08ee27 commit b344f63

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

app/bundle-app.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
declare let require: any;
1+
declare let require: any, global: any;
22

33
import { Application } from "@nativescript/core";
4-
import "./app.css"
4+
import "./app.css";
55

6-
const context = require.context('./', true, /.*\.(js|css|xml)/)
7-
global.registerWebpackModules(context);
6+
const context = require.context("./", true, /.*\.(js|css|xml)/);
7+
if (typeof global.registerWebpackModules !== "undefined") {
8+
global.registerWebpackModules(context);
9+
} else {
10+
global.registerBundlerModules(context);
11+
}
812

913
Application.run({ moduleName: "bundle-app-root" });

app/main.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
declare let require: any;
1+
declare let require: any, global: any;
22

33
import { Application } from "@nativescript/core";
44
import "./app.css";
55
import { registerTestRunner } from "./services/webpack-test-runner";
66

77
const context = require.context("./", true, /.*\.(js|css|xml)/);
8-
global.registerWebpackModules(context);
8+
if (typeof global.registerWebpackModules !== "undefined") {
9+
global.registerWebpackModules(context);
10+
} else {
11+
global.registerBundlerModules(context);
12+
}
913

1014
export interface RunTestAppOptions {
1115
runTests?: () => unknown;

nativescript.webpack.compat.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ function setupUnitTestBuild(config, env, webpack) {
119119
/* deep: */ true,
120120
/* filter: */ ${filesRegex}
121121
);
122-
global.registerWebpackModules(context);
122+
if (typeof global.registerWebpackModules !== 'undefined') {
123+
global.registerWebpackModules(context);
124+
} else {
125+
global.registerBundlerModules(context);
126+
}
123127
// VIRTUAL ENTRY END
124128
`);
125129

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"dom"
99
],
1010
"skipLibCheck": true,
11-
"noImplicitUseStrict": true,
1211
"experimentalDecorators": true,
1312
"emitDecoratorMetadata": true,
1413
"noEmitHelpers": true,

0 commit comments

Comments
 (0)