1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- import { defineConfig } from '@rspack/cli';
- import { rspack } from '@rspack/core';
- import { baseConfig } from './rspack.base.config';
- export default defineConfig({
- ...baseConfig,
- mode: 'production',
- entry: {
- main: './src/main.ts',
- },
- devtool: false,
- output: {
- clean: true,
- filename: '[name].[contenthash].js',
- chunkFilename: '[name].[contenthash].js',
- },
- optimization: {
- minimize: true,
- minimizer: [
- new rspack.SwcJsMinimizerRspackPlugin(),
- new rspack.LightningCssMinimizerRspackPlugin(),
- ],
- splitChunks: {
- chunks: 'async',
- minChunks: 1,
- minSize: 2000,
- maxAsyncRequests: 30,
- maxInitialRequests: 30,
- cacheGroups: {
- 'vue-router': {
- name: 'vue-router',
- test: /[\\/]node_modules[\\/]vue-router[\\/]/,
- priority: 120,
- chunks: 'all',
- reuseExistingChunk: true,
- },
- vue: {
- name: 'vue',
- test: /[\\/]node_modules[\\/]vue[\\/]/,
- priority: 200,
- chunks: 'all',
- reuseExistingChunk: true,
- },
- axios: {
- name: 'axios',
- test: /[\\/]node_modules[\\/]axios[\\/]/,
- priority: 9,
- chunks: 'all',
- reuseExistingChunk: true,
- },
- defaultVendors: {
- test: /[\\/]node_modules[\\/]/,
- priority: -10,
- reuseExistingChunk: true,
- },
- default: {
- minChunks: 2,
- priority: -20,
- reuseExistingChunk: true,
- },
- },
- },
- },
- experiments: {
- css: true,
- },
- });
|