From 9612bc236661c28bf6f7b09313653b00d5a3f275 Mon Sep 17 00:00:00 2001 From: Mael Thomas Date: Tue, 14 Mar 2017 15:00:54 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20webpack=201=20vers?= =?UTF-8?q?=20la=20v2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 22 ++++++++++++---------- source/.babelrc | 13 +++++++++---- source/postcss.config.js | 9 +++++++++ source/server.js | 4 ++-- source/webpack.config.js | 34 +++++++++++++++++++++++----------- 5 files changed, 55 insertions(+), 27 deletions(-) create mode 100644 source/postcss.config.js diff --git a/package.json b/package.json index 5b9bc833b..56a4aee53 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "node": ">=6.2.0" }, "dependencies": { - "babel-runtime": "^6.6.1", + "babel-runtime": "^6.23.0", "classnames": "^2.2.1", "deep-assign": "^2.0.0", "install": "^0.8.2", @@ -34,15 +34,17 @@ }, "devDependencies": { "autoprefixer": "^6.3.3", - "babel-core": "^6.7.4", + "babel": "^6.23.0", + "babel-core": "^6.24.0", "babel-eslint": "^7.1.1", - "babel-loader": "^6.2.4", - "babel-plugin-syntax-do-expressions": "^6.13.0", + "babel-loader": "^6.4.0", + "babel-plugin-transform-class-properties": "^6.23.0", "babel-plugin-transform-decorators-legacy": "^1.3.4", - "babel-polyfill": "^6.9.1", - "babel-preset-es2015": "^6.6.0", - "babel-preset-react": "^6.5.0", - "babel-preset-stage-0": "^6.5.0", + "babel-plugin-transform-do-expressions": "^6.22.0", + "babel-plugin-transform-object-rest-spread": "^6.23.0", + "babel-polyfill": "^6.23.0", + "babel-preset-env": "^1.2.1", + "babel-preset-react": "^6.23.0", "core-js": "^2.2.0", "css-loader": "^0.27.3", "eslint": "^3.13.1", @@ -60,8 +62,8 @@ "redux-devtools-log-monitor": "^1.0.9", "style-loader": "^0.13.0", "url-loader": "^0.5.7", - "webpack": "^1.12.14", - "webpack-dev-server": "^1.14.1", + "webpack": "^2.2.1", + "webpack-dev-server": "^2.4.2", "yaml-loader": "^0.4.0" }, "scripts": { diff --git a/source/.babelrc b/source/.babelrc index 32dd00f0e..a90201ae4 100644 --- a/source/.babelrc +++ b/source/.babelrc @@ -1,11 +1,16 @@ { "presets": [ - "es2015", - "react", - "stage-0" + ["env", { + "targets": { + "browsers": ["last 2 versions", "safari >= 7"] + } + }], + "react" ], "plugins": [ "transform-decorators-legacy", - "syntax-do-expressions" + "transform-do-expressions", + "transform-object-rest-spread", + "transform-class-properties" ] } diff --git a/source/postcss.config.js b/source/postcss.config.js new file mode 100644 index 000000000..2aa12db80 --- /dev/null +++ b/source/postcss.config.js @@ -0,0 +1,9 @@ +module.exports = { + plugins: [ + require('autoprefixer') + ] +} + +/* +browsers: [ '> 1% in FR', 'not ie < 10' ] +*/ diff --git a/source/server.js b/source/server.js index a40d45814..9f013a5cd 100644 --- a/source/server.js +++ b/source/server.js @@ -23,6 +23,6 @@ new WebpackDevServer(webpack(config), { } }).listen(3000, 'localhost', function (err) { if (err) - console.log(err) - console.log('Bonjour ! Je vous sers sur localhost:3000') + console.log(err) //eslint-disable-line no-console + console.log('Bonjour ! Je vous sers sur localhost:3000') //eslint-disable-line no-console }) diff --git a/source/webpack.config.js b/source/webpack.config.js index 8ab1a8e27..9082d7c7b 100644 --- a/source/webpack.config.js +++ b/source/webpack.config.js @@ -18,14 +18,31 @@ module.exports = { module: { loaders: [ { test: /\.css$/, - loader: 'style!css!postcss-loader' + use: [ + { + loader: 'style-loader', + }, + { + loader: 'css-loader', + options: { + sourceMap: true, + importLoaders: 1, + } + }, + { + loader: 'postcss-loader', + options: { + sourceMap: 'inline', + } + } + ] }, { test: /\.html$/, - loader: 'html' + loader: 'html-loader' }, { test: /\.yaml$/, - loader: 'json!yaml' + loader: 'json-loader!yaml-loader' }, { test: /\.js$/, @@ -34,20 +51,15 @@ module.exports = { }, { test: /\.(jpe?g|png|gif|svg)$/i, - loader: 'url?limit=10000!img?progressive=true' + loader: 'url-loader?limit=10000!img-loader?progressive=true' }, { test: /\.ne$/, - loader: 'nearley' + loader: 'nearley-loader' }] }, - postcss: [ - autoprefixer({ - browsers: [ '> 1% in FR', 'not ie < 10' ] - }) - ], plugins: [ new webpack.HotModuleReplacementPlugin(), - new webpack.NoErrorsPlugin(), + new webpack.NoEmitOnErrorsPlugin(), // in order to use the fetch polyfill: new webpack.ProvidePlugin({ 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'