Webpack build taking too much time -
i'm using webpack module bundler project. added third party libraries lead increase in build time. due uglify js plugin. build stucks @ 91% before compltetly running webpack. without plugin, it's taking less time. have use plugin. tried use parallel uglify js plugin. didn't seem work in case. suggest me in other ways should try succeed in reducing build time. have attached webpack file reference.
var webpack = require('webpack'); var path = require("path"); var glob = require("glob"); module.exports = { entry: glob.sync("./app/javascript/views/*.js") .reduce(function(map, path) { map[path.split('/').pop()] = path; return map; }, {}), output: { path: path.resolve(__dirname, 'app/assets/javascripts'), filename: '[name]' }, stats: { colors: true, reasons: false }, resolve: { extensions: ['.js', '.jsx'], alias: { 'styles': __dirname + '/app/assets/styles', 'js': __dirname + '/app/javascript/', "vendor": __dirname + '/vendor/', } }, module: { rules: [{ test: /\.(js|jsx)$/, exclude: [/node_modules/, /vendor/], enforce: 'pre', use: [{loader: 'eslint-loader'}] },{ test: /\.(js|jsx)$/, exclude: [/node_modules/, /vendor/], use: [{loader: 'babel-loader'}] },{ test: /[\\\/]vendor[\\\/]pages[\\\/]pages-plugins[\\\/]modernizr\.custom\.js$/, loader: "imports-loader?this=>window!exports-loader?window.modernizr" }] }, externals: { 'i18n': 'i18n', 'chargebee': 'chargebee', 'tlassets': 'tlassets' }, plugins: [ new webpack.defineplugin({ 'process.env': { 'node_env': json.stringify('production'), }, __debug__: false }), new webpack.provideplugin({ $: 'jquery', jquery: 'jquery', 'window.jquery': 'jquery', 'root.jquery': 'jquery', }), new webpack.loaderoptionsplugin({ minimize: true, options: { debug: false, devtool: false, eslint: { configfile: "./.eslintrc-prod" }, }, }), new webpack.optimize.occurrenceorderplugin(), new webpack.optimize.aggressivemergingplugin(), new webpack.optimize.uglifyjsplugin({ sourcenap: false, minimize: true, compress: { warnings: false, screw_ie8: true, conditionals: true, unused: true, comparisons: true, sequences: true, dead_code: true, evaluate: true, join_vars: true, if_return: true }, output: { comments: false } }), new webpack.noemitonerrorsplugin() ] };
Comments
Post a Comment