UNPKG

generator-wxnode-boilerplate

Version:

Yeoman generator for wxnode boilerplate

69 lines (65 loc) 2.03 kB
/** * the client webpack config will compile the vue files and produce * bundle json of client; */ const webpack = require('webpack'); const merge = require('webpack-merge'); const base = require('./webpack.base.config'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const VueSSRClientPlugin = require('vue-server-renderer/client-plugin'); const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin"); const path = require('path'); const config = merge(base, { entry: { app: './client/entry-client.ts' }, resolve: { alias: { } }, optimization: { runtimeChunk: { name: 'manifest' }, splitChunks: { chunks: 'all', minSize: 30000, // 大于30k才会产生一个chunk minChunks: 1, maxAsyncRequests: 5, maxInitialRequests: 3, name: true, cacheGroups: { commons: { name: 'vendor', chunks: 'initial', reuseExistingChunk: false, test: /node_modules\/(.*)\.js/ }, styles: { name: 'styles', test: /\.(less|scss|css)$/, chunks: 'all', minChunks: 1, reuseExistingChunk: true, enforce: true } } }, minimizer: [ new OptimizeCSSAssetsPlugin({}) ] }, plugins: [ // strip dev-only code in Vue source new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), 'process.env.VUE_ENV': '"client"' }), new VueSSRClientPlugin(), new HtmlWebpackPlugin({ template: path.resolve(process.cwd(), './public/index.client.html'), filename: 'index.html', }) ] }); module.exports = config;