Skip to content

Commit

Permalink
upgraded webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
antelle committed Sep 8, 2019
1 parent cda07f1 commit c1357e7
Show file tree
Hide file tree
Showing 6 changed files with 3,076 additions and 1,332 deletions.
38 changes: 21 additions & 17 deletions build/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ var path = require('path'),
var debug = process.argv.indexOf('--debug') > 0;

var StatsPlugin = require('stats-webpack-plugin');
var UglifyJsPlugin = require('uglifyjs-webpack-plugin');

module.exports = {
mode: 'production',
context: path.join(__dirname, '../../lib'),
entry: './index.js',
output: {
Expand All @@ -18,24 +20,15 @@ module.exports = {
libraryTarget: 'umd'
},
module: {
loaders: debug ? null : [{
rules: debug ? [] : [{
test: /\.js$/,
loader: 'uglify'
loader: 'uglify-loader'
}]
},
resolve: {
root: [path.join(__dirname, '../../lib')]
modules: [path.join(__dirname, '../../lib'), path.join(__dirname, '../../node_modules')]
},
resolveLoader: {
root: [path.join(__dirname, '../../node_modules')]
},
plugins: debug ? null : [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
mangle: { keep_fnames: true },
compress: false,
output: { ascii_only: true }
}),
plugins: [
new webpack.BannerPlugin('kdbxweb v' + pkg.version + ', (c) ' + new Date().getFullYear() + ' ' + pkg.author +
', opensource.org/licenses/' + pkg.license),
new StatsPlugin('stats.json', { chunkModules: true })
Expand All @@ -49,16 +42,27 @@ module.exports = {
crypto: false,
zlib: false
},
'uglify-loader': {
mangle: {},
compress: {},
output: { ascii_only: true }
optimization: {
minimizer: debug ? [] : [
new UglifyJsPlugin({
cache: true,
parallel: true,
uglifyOptions: {
mangle: {},
compress: {},
output: { ascii_only: true }
}
})
]
},
externals: {
fs: true,
path: true,
xmldom: true,
crypto: true,
zlib: true
},
performance: {
hints: false
}
};
13 changes: 7 additions & 6 deletions build/config/webpack.tests.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ walk.walkSync('test', function(basedir, filename, stat) {
});

module.exports = {
mode: 'production',
context: path.join(__dirname, '../../test'),
entry: entry,
output: {
Expand All @@ -20,16 +21,13 @@ module.exports = {
libraryTarget: 'umd'
},
module: {
loaders: [{
test: /argon2\-asm/,
rules: [{
test: /argon2-asm/,
loader: 'exports-loader?Module'
}]
},
resolve: {
root: [path.join(__dirname, '../../lib')]
},
resolveLoader: {
root: [path.join(__dirname, '../../node_modules')]
modules: [path.join(__dirname, '../../lib'), path.join(__dirname, '../../node_modules')]
},
node: {
console: false,
Expand All @@ -46,5 +44,8 @@ module.exports = {
xmldom: true,
crypto: true,
zlib: true
},
performance: {
hints: false
}
};
7 changes: 1 addition & 6 deletions dist/kdbxweb.js

Large diffs are not rendered by default.

0 comments on commit c1357e7

Please sign in to comment.