|
|
|
@ -18,13 +18,16 @@ |
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin'); |
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin'); |
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin'); |
|
|
|
const StyleLintPlugin = require('stylelint-webpack-plugin') |
|
|
|
const StyleLintPlugin = require('stylelint-webpack-plugin'); |
|
|
|
|
|
|
|
const webpack = require('webpack'); |
|
|
|
const path = require('path'); |
|
|
|
const dirTree = require('directory-tree'); |
|
|
|
const jsonminify = require("jsonminify"); |
|
|
|
|
|
|
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); |
|
|
|
const HappyPack = require('happypack'); |
|
|
|
|
|
|
|
const PUBLIC_RESOURCE_PATH = '/'; |
|
|
|
|
|
|
|
var langs = []; |
|
|
|
@ -34,6 +37,9 @@ dirTree('./src/app/locale/', {extensions:/\.json$/}, (item) => { |
|
|
|
langs.push(item.name.slice(item.name.lastIndexOf('-') + 1, -5)); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var happyThreadPool = HappyPack.ThreadPool({ size: 3 }); |
|
|
|
|
|
|
|
/* devtool: 'cheap-module-eval-source-map', */ |
|
|
|
|
|
|
|
module.exports = { |
|
|
|
@ -93,6 +99,25 @@ module.exports = { |
|
|
|
PUBLIC_PATH: JSON.stringify(PUBLIC_RESOURCE_PATH), |
|
|
|
SUPPORTED_LANGS: JSON.stringify(langs) |
|
|
|
}), |
|
|
|
new UglifyJsPlugin({ |
|
|
|
cache: true, |
|
|
|
parallel: true |
|
|
|
}), |
|
|
|
new HappyPack({ |
|
|
|
threadPool: happyThreadPool, |
|
|
|
id: 'cached-babel', |
|
|
|
loaders: ["babel-loader?cacheDirectory=true"] |
|
|
|
}), |
|
|
|
new HappyPack({ |
|
|
|
threadPool: happyThreadPool, |
|
|
|
id: 'eslint', |
|
|
|
loaders: ["eslint-loader?{parser: 'babel-eslint'}"] |
|
|
|
}), |
|
|
|
new HappyPack({ |
|
|
|
threadPool: happyThreadPool, |
|
|
|
id: 'ng-annotate-and-cached-babel-loader', |
|
|
|
loaders: ['ng-annotate', 'babel-loader?cacheDirectory=true'] |
|
|
|
}) |
|
|
|
], |
|
|
|
node: { |
|
|
|
tls: "empty", |
|
|
|
@ -102,19 +127,19 @@ module.exports = { |
|
|
|
loaders: [ |
|
|
|
{ |
|
|
|
test: /\.jsx$/, |
|
|
|
loader: 'babel', |
|
|
|
loader: 'happypack/loader?id=cached-babel', |
|
|
|
exclude: /node_modules/, |
|
|
|
include: __dirname, |
|
|
|
}, |
|
|
|
{ |
|
|
|
test: /\.js$/, |
|
|
|
loaders: ['ng-annotate', 'babel'], |
|
|
|
loaders: ['happypack/loader?id=ng-annotate-and-cached-babel-loader'], |
|
|
|
exclude: /node_modules/, |
|
|
|
include: __dirname, |
|
|
|
}, |
|
|
|
{ |
|
|
|
test: /\.js$/, |
|
|
|
loader: "eslint-loader?{parser: 'babel-eslint'}", |
|
|
|
loader: 'happypack/loader?id=eslint', |
|
|
|
exclude: /node_modules|vendor/, |
|
|
|
include: __dirname, |
|
|
|
}, |
|
|
|
|