diff --git a/dist/build-resources.js b/dist/build-resources.js index 37678ff..7a1bd13 100644 --- a/dist/build-resources.js +++ b/dist/build-resources.js @@ -639,4 +639,4 @@ function resolveTemplateResources(htmlFilePath, srcPath, externalModule) { }); return resources; -} \ No newline at end of file +} diff --git a/dist/index.js b/dist/index.js index 9d4d2f9..daf43f8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -304,4 +304,4 @@ var AureliaWebpackPlugin = function () { return AureliaWebpackPlugin; }(); -module.exports = AureliaWebpackPlugin; \ No newline at end of file +module.exports = AureliaWebpackPlugin; diff --git a/src/index.js b/src/index.js index 96241d3..0d41cca 100644 --- a/src/index.js +++ b/src/index.js @@ -213,7 +213,7 @@ class AureliaWebpackPlugin { let moduleId; if (options.nameLocalModules) { - if (module.resource.startsWith(options.src)) { + if (path.normalize(module.resource).startsWith(options.src)) { // paths inside SRC let relativeToSrc = path.relative(options.src, module.resource); moduleId = relativeToSrc; @@ -223,7 +223,7 @@ class AureliaWebpackPlugin { if (!moduleId && typeof module.userRequest == 'string') { // paths resolved as build resources let matchingModuleIds = paths - .filter(originPath => contextElements[originPath].source === module.userRequest) + .filter(originPath => contextElements[originPath].source === path.normalize(module.userRequest)) .map(originPath => path.normalize(originPath)); if (matchingModuleIds.length) { diff --git a/test/index.js b/test/index.js index 862d91f..2795abe 100644 --- a/test/index.js +++ b/test/index.js @@ -27,13 +27,12 @@ describe('Aurelia webpack plugin', function () { }; webpack(config, function (err, stats) { - expect(err).to.be.falsy; - expect(stats.hasErrors()).to.be.falsy; - expect(stats.hasWarnings()).to.be.falsy; + expect(err).to.be.null; + // Do not allow any errors, warnings are ok though + expect(stats.hasErrors()).to.be.false; - expect(fs.existsSync(path.join(OUTPUT_DIR, '1.bundle.js'))).to.be.truthy; - - // todo try to require from bundle + expect(fs.existsSync(path.join(OUTPUT_DIR, 'bundle.js'))).to.be.true; + expect(fs.existsSync(path.join(OUTPUT_DIR, '0.bundle.js'))).to.be.true; done(); });