Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove LazyParseWebpackPlugin, adding optimize-js #1419

Merged
merged 2 commits into from
Jan 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions config/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,27 @@ const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin');
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
const V8LazyParseWebpackPlugin = require('v8-lazy-parse-webpack-plugin');
const OptimizeJsPlugin = require('optimize-js-plugin');

/**
* Webpack Constants
*/
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 8080;
const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
const METADATA = webpackMerge(commonConfig({
env: ENV
}).metadata, {
host: HOST,
port: PORT,
ENV: ENV,
HMR: false
});

module.exports = function (env) {
return webpackMerge(commonConfig({env: ENV}), {
return webpackMerge(commonConfig({
env: ENV
}), {

/**
* Developer tool to enhance debugging
Expand Down Expand Up @@ -91,9 +96,9 @@ module.exports = function (env) {
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: 'css-loader'
}),
fallbackLoader: 'style-loader',
loader: 'css-loader'
}),
include: [helpers.root('src', 'styles')]
},

Expand All @@ -103,9 +108,9 @@ module.exports = function (env) {
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: 'css-loader!sass-loader'
}),
fallbackLoader: 'style-loader',
loader: 'css-loader!sass-loader'
}),
include: [helpers.root('src', 'styles')]
},

Expand All @@ -120,6 +125,17 @@ module.exports = function (env) {
*/
plugins: [

/**
* Webpack plugin to optimize a JavaScript file for faster initial load
* by wrapping eagerly-invoked functions.
*
* See: https://github.com/vigneshshanmugam/optimize-js-plugin
*/

new OptimizeJsPlugin({
sourceMap: false
}),

/**
* Plugin: ExtractTextPlugin
* Description: Extracts imported CSS files into external stylesheet
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"ngc-webpack": "1.1.0",
"node-sass": "^4.2.0",
"npm-run-all": "^4.0.0",
"optimize-js-plugin": "0.0.4",
"parse5": "^3.0.1",
"protractor": "^4.0.14",
"raw-loader": "0.5.1",
Expand All @@ -143,7 +144,6 @@
"typedoc": "^0.5.3",
"typescript": "~2.1.5",
"url-loader": "^0.5.7",
"v8-lazy-parse-webpack-plugin": "^0.3.0",
"webpack": "2.2.0",
"webpack-dev-middleware": "^1.9.0",
"webpack-dev-server": "2.2.0",
Expand Down