Skip to content

Commit

Permalink
feat(index): add the option 'nameLocalModules' for manually disabling…
Browse files Browse the repository at this point in the history
… moduleId remapping
  • Loading branch information
niieani committed Jul 28, 2016
1 parent fddd9e1 commit 2f9c89a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class AureliaWebpackPlugin {
options.root = options.root ? path.normalizeSafe(options.root) : path.dirname(module.parent.filename);
options.src = options.src ? path.normalizeSafe(options.src) : path.resolve(options.root, 'src');
options.nameExternalModules = options.nameExternalModules == undefined || options.nameExternalModules == true;
options.nameLocalModules = options.nameLocalModules == undefined || options.nameLocalModules == true;
options.resourceRegExp = options.resourceRegExp || /aurelia-loader-context/;
options.customViewLoaders = Object.assign({
'.css': ['css'],
Expand Down Expand Up @@ -210,10 +211,12 @@ class AureliaWebpackPlugin {
if (typeof module.resource == 'string') {
let moduleId;

if (module.resource.startsWith(options.src)) {
// paths inside SRC
let relativeToSrc = path.relative(options.src, module.resource);
moduleId = relativeToSrc;
if (options.nameLocalModules) {
if (module.resource.startsWith(options.src)) {
// paths inside SRC
let relativeToSrc = path.relative(options.src, module.resource);
moduleId = relativeToSrc;
}
}
if (options.nameExternalModules) {
if (!moduleId && typeof module.userRequest == 'string') {
Expand Down

0 comments on commit 2f9c89a

Please sign in to comment.