Skip to content

Commit

Permalink
Upgrade webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
fpagnoux authored Aug 28, 2018
2 parents d10c15f + 85641e0 commit 93bd8c7
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 56 deletions.
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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
}
20 changes: 15 additions & 5 deletions tests/integration/config-ci.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
// this file is for use in CircleCI continuous integration environment

var browserName = ['chrome', 'firefox', 'internet explorer', 'android'][process.env.CIRCLE_NODE_INDEX];
var capabilities = [
{browserName: 'chrome'},
{browserName: 'firefox'},
{browserName: 'internet explorer'},
{
deviceName: 'Samsung Galaxy S6 GoogleAPI Emulator',
browserName: 'Chrome',
platformName: 'Android',
platformVersion: '7.0'
}
][process.env.CIRCLE_NODE_INDEX];

module.exports = {
seleniumServerURL: {
hostname: 'ondemand.saucelabs.com',
port: 80
},
driverCapabilities: {
'tunnel-identifier': 'circle-' + process.env.CIRCLE_BUILD_NUM + '-' + process.env.CIRCLE_NODE_INDEX,
browserName: browserName
},
driverCapabilities: Object.assign({},
capabilities,
{'tunnel-identifier': 'circle-' + process.env.CIRCLE_BUILD_NUM + '-' + process.env.CIRCLE_NODE_INDEX}
),
tags: [ 'circle-ci', '#' + process.env.CIRCLE_BUILD_NUM ],
views: [ 'Verbose', 'SauceLabs' ],
quit: 'always', // avoid wasting 90 seconds on SauceLabs
Expand Down
46 changes: 22 additions & 24 deletions webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const port = config.port + 1


module.exports = {
mode: 'development',
// devtool: "eval", // Transformed code
devtool: 'source-map', // Original code
entry: {
Expand All @@ -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) {
Expand Down Expand Up @@ -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))
},
],
}
28 changes: 8 additions & 20 deletions webpack.config.prod.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)) },
],
}

0 comments on commit 93bd8c7

Please sign in to comment.