Skip to content

Commit

Permalink
Update the project to Webpack4 (cornerstonejs#248)
Browse files Browse the repository at this point in the history
* Try to upgrade to Webpack 4. Seems broken

* Switch branch to my Webpack fork for testing

* Updating Webpack: Switch to latest webpack version

* Bump versions of dependencies

* Add uglify plugin, remove dist again
  • Loading branch information
galelis authored and swederik committed Apr 2, 2018
1 parent 030fd4c commit 5a68f82
Show file tree
Hide file tree
Showing 6 changed files with 2,567 additions and 469 deletions.
6 changes: 3 additions & 3 deletions config/webpack/plugins/banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ const getCurrentDate = () => {
const date = ('0' + today.getDate()).slice(-2);

return `${year}-${month}-${date}`;
}
};

const getBanner = () => {
return `/*! ${pkg.name} - ${pkg.version} - ` +
`${getCurrentDate()} ` +
`| (c) 2016 Chris Hafey | https://github.com/cornerstonejs/cornerstone */`
}
};

module.exports = () => {
return new webpack.BannerPlugin({
banner: getBanner(),
entryOnly: true,
raw: true
});
}
};
1 change: 1 addition & 0 deletions config/webpack/webpack-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const outputPath = path.join(rootPath, 'dist');
const bannerPlugin = require(path.join(__dirname, 'plugins', 'banner.js'));

module.exports = {
mode: 'development',
context: context,
entry: {
cornerstone: path.join(context, 'index.js')
Expand Down
19 changes: 13 additions & 6 deletions config/webpack/webpack-prod.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
const webpack = require('webpack');
const merge = require('./merge');
const baseConfig = require('./webpack-base');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');

const devConfig = {
output: {
filename: '[name].min.js'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
sourceMap: true
})
]
mode: "production",
optimization: {
minimizer: [
new UglifyJSPlugin({
uglifyOptions: {
sourceMap: true
}
})
]
},
};

module.exports = merge(baseConfig, devConfig);
module.exports = merge(baseConfig, devConfig);
Loading

0 comments on commit 5a68f82

Please sign in to comment.