Skip to content

Commit

Permalink
Merge pull request #91 from marktaling/windows-paths-fix
Browse files Browse the repository at this point in the history
 fix(webpack-plugin): Windows specific paths fix
  • Loading branch information
EisenbergEffect authored Feb 16, 2017
2 parents 0559df5 + c3924a0 commit 964f8c7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/build-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,4 +639,4 @@ function resolveTemplateResources(htmlFilePath, srcPath, externalModule) {
});

return resources;
}
}
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,4 @@ var AureliaWebpackPlugin = function () {
return AureliaWebpackPlugin;
}();

module.exports = AureliaWebpackPlugin;
module.exports = AureliaWebpackPlugin;
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
11 changes: 5 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit 964f8c7

Please sign in to comment.