Skip to content

Commit

Permalink
cope with ext being part of name or path
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusweiss authored and leftstick committed Nov 10, 2017
1 parent 44a7631 commit 165fc4c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const getFileName = function(name, ext, opts) {

const suffix = (opts.postfix || 'nomin') + '.' + ext;
if (name.match(new RegExp('\.' + ext + '$'))) {
return name.replace(new RegExp(ext), suffix)
return name.replace(new RegExp(ext + '$'), suffix)
}

return name + suffix;
Expand Down
25 changes: 25 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,31 @@ describe('testing', function() {
done();
});
});

it('Admin/js/Admin.js as output', function(done) {
var compiler = webpack({
entry: {
index: resolve(curDir, 'simple', 'index.js')
},
output: {
path: resolve(curDir, 'build'),
filename: 'Admin/js/Admin.js'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new UnminifiedWebpackPlugin()
]
});

compiler.run(function(err, stats) {
assert(fileExist(resolve(curDir, 'build', 'Admin/js/Admin.nomin.js')));
done();
});
});
});


Expand Down

0 comments on commit 165fc4c

Please sign in to comment.