Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 404abbb

Browse files
PeterStaevsis0k0
authored andcommitted
feat: add setting for plain modules regex (#582)
Adds a registerModules option for the bundle-config-loader that allows users to specify custom regex to register their modules. Also if needed they can set the new option to false completely disabling automatic module registration for non-angular apps. Closes #556
1 parent e349fa8 commit 404abbb

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

Diff for: bundle-config-loader.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
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
}

Diff for: register-modules.js

-3
This file was deleted.

0 commit comments

Comments
 (0)