Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 upgrade to webpack 4 #3252

Merged
merged 13 commits into from
Jan 9, 2019
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"react-test-renderer": "^16.2.0",
"sass-inline-svg": "^1.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
4 changes: 1 addition & 3 deletions packages/core/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ const path = require("path");

module.exports = Object.assign({}, baseConfig, {
entry: {
core: [
"./src/index.ts"
],
core: "./src/index.ts",
},

externals: COMMON_EXTERNALS,
Expand Down
2 changes: 1 addition & 1 deletion packages/datetime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/docs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"@blueprintjs/webpack-build-scripts": "*",
"@types/chroma-js": "^1.3.3",
"npm-run-all": "^4.1.2",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1"
"webpack": "^4.27.1",
"webpack-dev-server": "^3.1.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/labs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/landing-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
},
"devDependencies": {
"@blueprintjs/webpack-build-scripts": "*",
"copy-webpack-plugin": "^4.2.0",
"copy-webpack-plugin": "^4.6.0",
"npm-run-all": "^4.1.2",
"raw-loader": "^0.5.1",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1"
"raw-loader": "^1.0.0",
"webpack": "^4.27.1",
"webpack-dev-server": "^3.1.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/table-dev-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"@blueprintjs/webpack-build-scripts": "*",
"npm-run-all": "^4.1.2",
"stylelint": "~8.4.0",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1"
"webpack": "^4.27.1",
"webpack-dev-server": "^3.1.0"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1"
"webpack": "^4.27.1",
"webpack-dev-server": "^3.1.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/timezone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
30 changes: 15 additions & 15 deletions packages/webpack-build-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
},
"dependencies": {
"autoprefixer": "^7.1.2",
"awesome-typescript-loader": "^3.4.1",
"circular-dependency-plugin": "^4.3.0",
"css-loader": "^0.28.8",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.6",
"node-sass": "^4.7.2",
"awesome-typescript-loader": "^5.2.1",
"circular-dependency-plugin": "^5.0.2",
"css-loader": "^2.0.1",
"file-loader": "^2.0.0",
"mini-css-extract-plugin": "^0.5.0",
"node-sass": "^4.11.0",
"postcss-discard-comments": "^2.0.4",
"postcss-loader": "^2.0.10",
"sass-loader": "^6.0.6",
"source-map-loader": "^0.2.3",
"style-loader": "^0.19.1",
"uglifyjs-webpack-plugin": "^1.1.6",
"webpack": "^3.10.0",
"webpack-bundle-analyzer": "^2.9.2",
"webpack-dev-server": "^2.11.1",
"webpack-notifier": "^1.5.0"
"postcss-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"source-map-loader": "^0.2.4",
"style-loader": "^0.23.1",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "^4.27.1",
"webpack-bundle-analyzer": "^3.0.3",
"webpack-dev-server": "^3.1.0",
"webpack-notifier": "^1.7.0"
},
"repository": {
"type": "git",
Expand Down
25 changes: 5 additions & 20 deletions packages/webpack-build-scripts/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const webpack = require("webpack");
// webpack plugins
const { CheckerPlugin } = require("awesome-typescript-loader");
const CircularDependencyPlugin = require("circular-dependency-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
giladgray marked this conversation as resolved.
Show resolved Hide resolved
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const WebpackNotifierPlugin = require("webpack-notifier");
Expand Down Expand Up @@ -38,27 +38,14 @@ const plugins = [
];
if (IS_PRODUCTION) {
plugins.push(
// Define JS globals when running the build
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production"),
},
}),

// Some loaders accept configuration through webpack internals
new webpack.LoaderOptionsPlugin({
debug: false,
minimize: true,
}),

// Only extract CSS to a file for production because it is slow
new ExtractTextPlugin("[name].css"),

// Minify JS
new UglifyJsPlugin(),
giladgray marked this conversation as resolved.
Show resolved Hide resolved

// Use scope hoisting to reduce the number of closures in the bundle script
new webpack.optimize.ModuleConcatenationPlugin(),
new MiniCssExtractPlugin({ filename: "[name].css" }),

// add production plugins here
);
Expand All @@ -77,7 +64,6 @@ if (IS_PRODUCTION) {
const scssLoaders = [
{
loader: require.resolve("css-loader"),
options: { minimize: IS_PRODUCTION },
giladgray marked this conversation as resolved.
Show resolved Hide resolved
},
{
loader: require.resolve("postcss-loader"),
Expand Down Expand Up @@ -109,6 +95,8 @@ module.exports = {
port: DEV_PORT,
},

mode: IS_PRODUCTION ? "production" : "development",

module: {
rules: [
{
Expand All @@ -121,10 +109,7 @@ module.exports = {
{
test: /\.scss$/,
use: IS_PRODUCTION
? ExtractTextPlugin.extract({
fallback: require.resolve("style-loader"),
use: scssLoaders
})
? [ MiniCssExtractPlugin.loader, ...scssLoaders ]
: [ require.resolve("style-loader"), ...scssLoaders ],
},
{
Expand Down
Loading