diff --git a/package.json b/package.json index a19a35b7..1c45638e 100644 --- a/package.json +++ b/package.json @@ -23,15 +23,15 @@ "accept-language": "^3.0.17", "babel-cli": "^6.11.4", "babel-core": "^6.9.0", - "babel-loader": "^6.2.4", - "babel-plugin-react-transform": "^2.0.2", + "babel-loader": "^7.1.5", + "babel-plugin-react-transform": "^3.0.0", "babel-polyfill": "^6.9.0", "babel-preset-es2015": "^6.9.0", "babel-preset-react": "^6.5.0", "babel-preset-stage-0": "^6.5.0", "babel-register": "^6.9.0", "bootstrap": "^3.3.5", - "copy-webpack-plugin": "^3.0.1", + "copy-webpack-plugin": "^4.5.2", "diacritics": "^1.3.0", "dotenv": "^6.0.0", "express": "^4.12.4", @@ -51,11 +51,11 @@ "react-router": "^3.2.1", "serve-favicon": "^2.3.0", "swagger-ui": "~3.17.3", - "webpack": "^1.9.11" + "webpack": "^4.16.5" }, "devDependencies": { "babel-eslint": "^8.2.6", - "concurrently": "^2.2.0", + "concurrently": "^3.6.1", "enzyme": "^3.4.4", "enzyme-adapter-react-16": "^1.2.0", "eslint": "^5.4.0", @@ -65,8 +65,9 @@ "react-transform-hmr": "^1.0.4", "should": "^13.2.3", "watai": "^0.7.0", - "webpack-dev-server": "^1.9.0", - "webpack-error-notification": "^0.1.4" + "webpack-cli": "^3.1.0", + "webpack-dev-server": "^3.1.5", + "webpack-error-notification": "^0.1.8" }, "private": true } diff --git a/webpack.config.dev.js b/webpack.config.dev.js index 075dba6e..e9f1928a 100644 --- a/webpack.config.dev.js +++ b/webpack.config.dev.js @@ -17,6 +17,7 @@ const port = config.port + 1 module.exports = { + mode: 'development', // devtool: "eval", // Transformed code devtool: 'source-map', // Original code entry: { @@ -39,39 +40,34 @@ module.exports = { fs: 'empty' }, module: { - loaders: [ + rules: [ { - exclude: /(node_modules|public)/, - loader: 'babel', - query: { - 'plugins': [ - ['react-transform', { - 'transforms': [{ - 'transform': 'react-transform-hmr', - 'imports': ['react'], - 'locals': ['module'], - }], - }], - ], - }, test: /\.jsx?$/, - }, - { - loader: 'json-loader', - test: /\.json$/, + exclude: /(node_modules|public)/, + use: [{ + loader: 'babel-loader', + options: { + plugins: [ + ['react-transform', { + 'transforms': [{ + 'transform': 'react-transform-hmr', + 'imports': ['react'], + 'locals': ['module'], + }] + }] + ] + } + }] } - ], + ] }, resolve: { - extensions: ['', '.js', '.jsx'], + extensions: ['.js', '.jsx'], }, - progress: true, plugins: [ // hot reload new webpack.HotModuleReplacementPlugin(), - new webpack.NoErrorsPlugin(), - // print a webpack progress new webpack.ProgressPlugin((percentage) => { if (percentage === 1) { @@ -106,6 +102,8 @@ module.exports = { {from: 'node_modules/swagger-ui/dist/swagger-ui.css', to: '.'}, ]), - function() { this.plugin('done', writeAssets(path.resolve(__dirname, 'webpack-assets.json'))) }, + function() { + this.plugin('done', writeAssets(path.resolve(__dirname, 'webpack-assets.json')).bind(this)) + }, ], } diff --git a/webpack.config.prod.babel.js b/webpack.config.prod.babel.js index de505ce7..d3ac76d0 100644 --- a/webpack.config.prod.babel.js +++ b/webpack.config.prod.babel.js @@ -26,22 +26,19 @@ module.exports = { fs: 'empty' }, module: { - loaders: [ + rules: [ { + test: /\.jsx?$/, exclude: /(node_modules|public)/, - loader: 'babel', - test: /\.(js|jsx)$/, - }, - { - loader: 'json-loader', - test: /\.json$/, + use: [{ + loader: 'babel-loader' + }] } - ], + ] }, resolve: { - extensions: ['', '.js', '.jsx'], + extensions: ['.js', '.jsx'], }, - progress: true, plugins: [ // set global vars @@ -66,15 +63,6 @@ module.exports = { {from: 'node_modules/swagger-ui/dist/swagger-ui.css', to: '.'}, ]), - // optimizations - new webpack.optimize.DedupePlugin(), - new webpack.optimize.OccurenceOrderPlugin(), - new webpack.optimize.UglifyJsPlugin({ - compress: { - warnings: false, - }, - }), - - function() { this.plugin('done', writeAssets(path.resolve(__dirname, 'webpack-assets.json'))) }, + function() { this.plugin('done', writeAssets(path.resolve(__dirname, 'webpack-assets.json')).bind(this)) }, ], }