diff --git a/bundle-config-loader.js b/bundle-config-loader.js index 1f6487a2..cf3d70fb 100644 --- a/bundle-config-loader.js +++ b/bundle-config-loader.js @@ -1,15 +1,16 @@ -module.exports = function(source) { +module.exports = function (source) { this.cacheable(); - const { angular = false, loadCss = true } = this.query; + const { angular = false, loadCss = true, registerModules = /(root|page)\.(xml|css|js|ts|scss)$/ } = this.query; source = ` require("tns-core-modules/bundle-entry-points"); ${source} `; - if (!angular) { + if (!angular && registerModules) { source = ` - require("nativescript-dev-webpack/register-modules"); + const context = require.context("~/", true, ${registerModules}); + global.registerWebpackModules(context); ${source} `; } diff --git a/register-modules.js b/register-modules.js deleted file mode 100644 index d6fccab1..00000000 --- a/register-modules.js +++ /dev/null @@ -1,3 +0,0 @@ -const context = require.context("~/", true, /(root|page)\.(xml|css|js|ts|scss)$/); -global.registerWebpackModules(context); -