Привет, у меня есть приложение activJS.Я также использую веб-пакет.Когда я запускаю npm run build
Мое приложение связывается и сохраняется.
Теперь мой build.js занимает около 60 МБ.
Есть ли способ сжать или уменьшить это?
Заранее спасибо
ОБНОВЛЕНИЕ:
У меня есть много импортированных пакетов.я должен также опубликовать package.json?
webpack.config
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const settings = {
entry: {
bundle: [
'babel-polyfill',
'whatwg-fetch',
'react-hot-loader/patch',
'./src/frontend/Index.js'
]
},
output: {
filename: '[name].js',
publicPath: '/',
path: path.resolve('build')
},
resolve: {
extensions: ['.js', '.json', '.css']
},
devtool: 'eval-source-map',
module: {
rules: [
{
test: /\.js?$/,
loader: 'babel-loader',
options: {
presets: [
['es2015', {modules: false}],
'stage-0',
'stage-2',
'react'
],
plugins: [
'transform-node-env-inline'
],
env: {
development: {
plugins: ['react-hot-loader/babel']
}
}
}
},
{
test: /\.scss$/,
use: [{
loader: 'style-loader' // creates style nodes from JS strings
}, {
loader: 'css-loader' // translates CSS into CommonJS
}, {
loader: 'sass-loader' // compiles Sass to CSS
}]
},
{
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
},
{
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/octet-stream'
},
{
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader'
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=image/svg+xml'
},
{
test: /\.(jpe?g|png|gif)$/i,
loaders: ['file-loader?context=src/images&name=images/[path][name].[ext]', {
loader: 'image-webpack-loader',
query: {
mozjpeg: {
progressive: true
},
gifsicle: {
interlaced: false
},
optipng: {
optimizationLevel: 4
},
pngquant: {
quality: '75-90',
speed: 3
}
}
}],
exclude: /node_modules/,
include: __dirname
},
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
importLoaders: 1,
localIdentName: '[name]--[local]--[hash:base64:8]'
}
},
'postcss-loader' // has separate config, see postcss.config.js nearby
]
}
]
},
devServer: {
contentBase: path.resolve('src/www'),
publicPath: '/',
port: 8080,
quiet: false,
hot: true,
historyApiFallback: true,
inline: true
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.LoaderOptionsPlugin({
debug: true
}),
new CopyWebpackPlugin([
{from: 'src/www/'}
])
]
};
module.exports = settings;