Skip to content

Commit d0ac8bf

Browse files
committed
feat: add setting for plain modules regex
closes NativeScript#556
1 parent e349fa8 commit d0ac8bf

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

Diff for: bundle-config-loader.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
module.exports = function(source) {
1+
module.exports = function (source) {
22
this.cacheable();
3-
const { angular = false, loadCss = true } = this.query;
3+
const { angular = false, loadCss = true, registerModules = /(root|page)\.(xml|css|js|ts|scss)$/ } = this.query;
44

55
source = `
66
require("tns-core-modules/bundle-entry-points");
77
${source}
88
`;
99

10-
if (!angular) {
10+
if (!angular && registerModules) {
1111
source = `
12-
require("nativescript-dev-webpack/register-modules");
12+
const context = require.context("~/", true, ${registerModules});
13+
global.registerWebpackModules(context);
1314
${source}
1415
`;
1516
}
1617

1718
if (loadCss) {
1819
source = `
1920
require("${
20-
angular ?
21-
'nativescript-dev-webpack/load-application-css-angular' :
22-
'nativescript-dev-webpack/load-application-css-regular'
21+
angular ?
22+
'nativescript-dev-webpack/load-application-css-angular' :
23+
'nativescript-dev-webpack/load-application-css-regular'
2324
}")();
2425
${source}
2526
`;

Diff for: register-modules.js

-3
This file was deleted.

0 commit comments

Comments
 (0)