Re-Introducing HappyPack (#4669)

* Updating Dev Dependencies (minor version updates)

* Re-introduce HappyPack

* Added Yarn Lock file

* Use HappyPack

* Linting

* Delete yarn lock file
This commit is contained in:
Nicolas Gotchac 2017-03-07 20:39:36 +01:00 committed by Jaco Greeff
parent c3c83086bc
commit a587815ddc
7 changed files with 68 additions and 79 deletions

1
js/.gitignore vendored
View File

@ -8,3 +8,4 @@ docs
.happypack .happypack
.npmjs .npmjs
.eslintcache .eslintcache
yarn.lock

View File

@ -57,28 +57,28 @@
"prepush": "npm run lint:cached" "prepush": "npm run lint:cached"
}, },
"devDependencies": { "devDependencies": {
"babel-cli": "6.22.2", "babel-cli": "6.23.0",
"babel-core": "6.22.1", "babel-core": "6.23.1",
"babel-eslint": "7.1.1", "babel-eslint": "7.1.1",
"babel-loader": "6.2.10", "babel-loader": "6.3.2",
"babel-plugin-lodash": "3.2.11", "babel-plugin-lodash": "3.2.11",
"babel-plugin-react-intl": "2.3.1", "babel-plugin-react-intl": "2.3.1",
"babel-plugin-recharts": "1.1.0", "babel-plugin-recharts": "1.1.0",
"babel-plugin-transform-class-properties": "6.22.0", "babel-plugin-transform-class-properties": "6.23.0",
"babel-plugin-transform-decorators-legacy": "1.3.4", "babel-plugin-transform-decorators-legacy": "1.3.4",
"babel-plugin-transform-object-rest-spread": "6.22.0", "babel-plugin-transform-object-rest-spread": "6.23.0",
"babel-plugin-transform-react-remove-prop-types": "0.3.0", "babel-plugin-transform-react-remove-prop-types": "0.3.2",
"babel-plugin-transform-runtime": "6.22.0", "babel-plugin-transform-runtime": "6.23.0",
"babel-plugin-webpack-alias": "2.1.2", "babel-plugin-webpack-alias": "2.1.2",
"babel-polyfill": "6.22.0", "babel-polyfill": "6.23.0",
"babel-preset-env": "1.1.8", "babel-preset-env": "1.1.9",
"babel-preset-es2015": "6.22.0", "babel-preset-es2015": "6.22.0",
"babel-preset-es2016": "6.22.0", "babel-preset-es2016": "6.22.0",
"babel-preset-es2017": "6.22.0", "babel-preset-es2017": "6.22.0",
"babel-preset-react": "6.22.0", "babel-preset-react": "6.23.0",
"babel-preset-stage-0": "6.22.0", "babel-preset-stage-0": "6.22.0",
"babel-register": "6.22.0", "babel-register": "6.23.0",
"babel-runtime": "6.22.0", "babel-runtime": "6.23.0",
"chai": "3.5.0", "chai": "3.5.0",
"chai-as-promised": "6.0.0", "chai-as-promised": "6.0.0",
"chai-enzyme": "0.6.1", "chai-enzyme": "0.6.1",
@ -86,62 +86,62 @@
"circular-dependency-plugin": "2.0.0", "circular-dependency-plugin": "2.0.0",
"copy-webpack-plugin": "4.0.1", "copy-webpack-plugin": "4.0.1",
"core-js": "2.4.1", "core-js": "2.4.1",
"coveralls": "2.11.15", "coveralls": "2.11.16",
"css-loader": "0.26.1", "css-loader": "0.26.1",
"ejs-loader": "0.3.0", "ejs-loader": "0.3.0",
"ejsify": "1.0.0", "ejsify": "1.0.0",
"enzyme": "2.7.0", "enzyme": "2.7.1",
"eslint": "3.11.1", "eslint": "3.16.1",
"eslint-config-semistandard": "7.0.0", "eslint-config-semistandard": "7.0.0",
"eslint-config-standard": "6.2.1", "eslint-config-standard": "6.2.1",
"eslint-config-standard-react": "4.2.0", "eslint-config-standard-react": "4.2.0",
"eslint-plugin-promise": "3.4.0", "eslint-plugin-promise": "3.4.2",
"eslint-plugin-react": "6.8.0", "eslint-plugin-react": "6.10.0",
"eslint-plugin-standard": "2.0.1", "eslint-plugin-standard": "2.0.1",
"express": "4.14.0", "express": "4.14.1",
"extract-loader": "0.1.0", "extract-loader": "0.1.0",
"extract-text-webpack-plugin": "2.0.0-beta.4", "extract-text-webpack-plugin": "2.0.0-beta.4",
"file-loader": "0.9.0", "file-loader": "0.10.0",
"happypack": "3.0.2", "happypack": "3.0.3",
"html-loader": "0.4.4", "html-loader": "0.4.4",
"html-webpack-plugin": "2.24.1", "html-webpack-plugin": "2.28.0",
"http-proxy-middleware": "0.17.3", "http-proxy-middleware": "0.17.3",
"husky": "0.11.9", "husky": "0.13.1",
"ignore-styles": "5.0.1", "ignore-styles": "5.0.1",
"image-webpack-loader": "3.1.0", "image-webpack-loader": "3.2.0",
"istanbul": "1.0.0-alpha.2", "istanbul": "1.0.0-alpha.2",
"jsdom": "9.9.1", "jsdom": "9.11.0",
"json-loader": "0.5.4", "json-loader": "0.5.4",
"mocha": "3.2.0", "mocha": "3.2.0",
"mock-local-storage": "1.0.2", "mock-local-storage": "1.0.2",
"mock-socket": "6.0.4", "mock-socket": "6.0.4",
"nock": "9.0.2", "nock": "9.0.7",
"postcss-import": "9.0.0", "postcss-import": "9.1.0",
"postcss-loader": "1.2.1", "postcss-loader": "1.3.2",
"postcss-nested": "1.0.0", "postcss-nested": "1.0.0",
"postcss-simple-vars": "3.0.0", "postcss-simple-vars": "3.0.0",
"progress": "1.1.8", "progress": "1.1.8",
"progress-bar-webpack-plugin": "1.9.1", "progress-bar-webpack-plugin": "1.9.3",
"raw-loader": "0.5.1", "raw-loader": "0.5.1",
"react-addons-perf": "15.4.1", "react-addons-perf": "15.4.2",
"react-addons-test-utils": "15.4.1", "react-addons-test-utils": "15.4.2",
"react-hot-loader": "3.0.0-beta.6", "react-hot-loader": "3.0.0-beta.6",
"react-intl-aggregate-webpack-plugin": "0.0.1", "react-intl-aggregate-webpack-plugin": "0.0.1",
"rucksack-css": "0.9.1", "rucksack-css": "0.9.1",
"script-ext-html-webpack-plugin": "1.3.5", "script-ext-html-webpack-plugin": "1.7.1",
"serviceworker-webpack-plugin": "0.1.7", "serviceworker-webpack-plugin": "0.2.0",
"sinon": "1.17.6", "sinon": "1.17.7",
"sinon-as-promised": "4.0.2", "sinon-as-promised": "4.0.2",
"sinon-chai": "2.8.0", "sinon-chai": "2.8.0",
"style-loader": "0.13.1", "style-loader": "0.13.1",
"stylelint": "7.7.0", "stylelint": "7.9.0",
"stylelint-config-standard": "15.0.1", "stylelint-config-standard": "16.0.0",
"to-source": "2.0.3", "to-source": "2.0.3",
"url-loader": "0.5.7", "url-loader": "0.5.7",
"webpack": "2.2.1", "webpack": "2.2.1",
"webpack-dev-middleware": "1.9.0", "webpack-dev-middleware": "1.10.1",
"webpack-error-notification": "0.1.6", "webpack-error-notification": "0.1.6",
"webpack-hot-middleware": "2.14.0", "webpack-hot-middleware": "2.17.1",
"websocket": "1.0.24", "websocket": "1.0.24",
"yargs": "6.6.0" "yargs": "6.6.0"
}, },

View File

@ -62,8 +62,7 @@ module.exports = {
{ {
test: /\.js$/, test: /\.js$/,
exclude: /(node_modules)/, exclude: /(node_modules)/,
// use: [ 'happypack/loader?id=js' ] use: [ 'happypack/loader?id=babel-js' ]
use: isProd ? 'babel-loader' : 'babel-loader?cacheDirectory=true'
}, },
{ {
test: /\.js$/, test: /\.js$/,
@ -96,17 +95,16 @@ module.exports = {
test: /\.css$/, test: /\.css$/,
include: [ /src/ ], include: [ /src/ ],
// exclude: [ /src\/dapps/ ], // exclude: [ /src\/dapps/ ],
loader: (isProd && !isEmbed) ? ExtractTextPlugin.extract([ loader: (isProd && !isEmbed)
? ExtractTextPlugin.extract([
// 'style-loader', // 'style-loader',
'css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]', 'css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]',
'postcss-loader' 'postcss-loader'
]) : undefined, ])
// use: [ 'happypack/loader?id=css' ] : undefined,
use: (isProd && !isEmbed) ? undefined : [ use: (isProd && !isEmbed)
'style-loader', ? undefined
'css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]', : [ 'happypack/loader?id=css' ]
'postcss-loader'
]
}, },
{ {

View File

@ -48,7 +48,7 @@ let progressBar = { update: () => {} };
webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin()); webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
webpackConfig.plugins.push(new webpack.NamedModulesPlugin()); webpackConfig.plugins.push(new webpack.NamedModulesPlugin());
webpackConfig.plugins.push(new webpack.NoErrorsPlugin()); webpackConfig.plugins.push(new webpack.NoEmitOnErrorsPlugin());
webpackConfig.plugins.push(new webpack.ProgressPlugin( webpackConfig.plugins.push(new webpack.ProgressPlugin(
(percentage) => progressBar.update(percentage) (percentage) => progressBar.update(percentage)

View File

@ -17,7 +17,7 @@
const webpack = require('webpack'); const webpack = require('webpack');
const path = require('path'); const path = require('path');
const fs = require('fs'); const fs = require('fs');
// const HappyPack = require('happypack'); const HappyPack = require('happypack');
const postcssImport = require('postcss-import'); const postcssImport = require('postcss-import');
const postcssNested = require('postcss-nested'); const postcssNested = require('postcss-nested');
@ -85,32 +85,21 @@ function getPlugins (_isProd = isProd) {
format: '[:msg] [:bar] ' + ':percent' + ' (:elapsed seconds)' format: '[:msg] [:bar] ' + ':percent' + ' (:elapsed seconds)'
}), }),
// NB: HappyPack is not yet working with Webpack 2... (as of Nov. 26) new HappyPack({
id: 'css',
threads: 4,
loaders: [
'style-loader',
'css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]',
'postcss-loader'
]
}),
// new HappyPack({ new HappyPack({
// id: 'css', id: 'babel-js',
// threads: 4, threads: 4,
// loaders: [ loaders: [ isProd ? 'babel-loader' : 'babel-loader?cacheDirectory=true' ]
// 'style-loader', }),
// 'css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]',
// 'postcss-loader'
// ]
// }),
// new HappyPack({
// id: 'js',
// threads: 4,
// loaders: _isProd ? ['babel'] : [
// 'react-hot-loader',
// 'babel-loader?cacheDirectory=true'
// ]
// }),
// new HappyPack({
// id: 'babel',
// threads: 4,
// loaders: ['babel-loader']
// }),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': { 'process.env': {

View File

@ -44,7 +44,8 @@ let modules = [
'recharts', 'recharts',
'redux', 'redux',
'redux-thunk', 'redux-thunk',
'scryptsy' 'scryptsy',
'zxcvbn'
]; ];
module.exports = { module.exports = {