Why the webpack increases the output file so large -
i wrote simple script within typescript , es6 has nothing todo react or library. however, source files less 200 lines (<5k) exported bundle.js around 100k. it's unreasonable.
here's webpack config. generated bundle.js webpack node_env=production --optimize-minimize
the file exceed 300k if not doing optimize.
var webpack = require('webpack'); module.exports = { entry: { timer: "./src/test.ts", }, output: { path: "./js", filename: "[name]-bundle.js" }, devtool: 'source-map', resolve: { extensions: ['', '.ts', '.tsx', '.js', '.json'] }, module: { preloaders: [ {test: /\.json$/, exclude: /node_modules/, loader: 'json'}, ], loaders: [ {test: /\.tsx?$/, loader: 'ts-loader'}, {test: /\.scss$/, loaders: ['style', 'css', 'sass']}, { test: /\.css$/, loader: 'style!css!' }, {test: /\.png$/, loader: 'url-loader?mimetype=image/png'}, {test: /\.json$/, loader: 'json'} ], preloaders: [ {test: /\.js$/, loader: 'source-map-loader'} ] }, devserver: { stats: 'errors-only', hot: true }, plugins: [ new webpack.hotmodulereplacementplugin(), new webpack.defineplugin({ 'process.env': 'production' }) ], target: 'node' };
Comments
Post a Comment