1 Star 1 Fork 1

Benzolamps/bz-music-we

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vue.config.js 3.14 KB
一键复制 编辑 原始数据 按行查看 历史
Benzolamps 提交于 2023-10-24 09:39 . 优化
const {join} = require('path');
function resolve(...dir) {
return join(process.cwd(), ...dir);
}
const {defineConfig} = require('@vue/cli-service');
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
const {GenerateSW} = require('workbox-webpack-plugin');
module.exports = defineConfig({
transpileDependencies: true,
productionSourceMap: false,
publicPath: './',
devServer: {
host: '0.0.0.0',
port: 9826,
allowedHosts: 'all'
},
pages: {
index: {
title: require('./package.json').description,
entry: 'src/main.ts',
template: 'src/templates/index.ejs'
}
},
chainWebpack(config) {
config.module.rules.delete('svg');
},
configureWebpack: {
resolve: {
alias: {
'butterchurn': resolve('butterchurn'),
'butterchurn-presets': [
resolve('src/assets/presets/sample'),
resolve('node_modules/butterchurn-presets/presets/converted')
]
}
},
module: {
rules: [
{
test: /\.svg$/,
include: resolve('src/assets'),
use: [
{
loader: 'svg-sprite-loader',
options: {
symbolId: 'icon-[name]'
}
}
]
},
{
test: /\.asc\.ts$/,
use: [
{
loader: resolve('butterchurn/loaders/assemblyscript.js')
}
]
},
{
test: /\.(jpg|png|gif|wav|zip)$/,
include: resolve('src/assets'),
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: 1024 * 1024
}
}
},
{
test: /\.lrc$/,
type: 'asset/source'
}
]
},
plugins: [
new NodePolyfillPlugin(),
new GenerateSW(Object.assign({
disableDevLogs: true,
inlineWorkboxRuntime: true,
maximumFileSizeToCacheInBytes: 100 * 1024 * 1024,
exclude: [/\.(js|css|html)/].filter(() => process.env.NODE_ENV === 'development'),
manifestTransforms: [
function (manifest) {
for (const entry of manifest) {
if (entry.url !== 'index.html') {
entry.url = process.env.VUE_APP_REMOTE_URL + entry.url;
}
}
return {manifest};
}
].filter(() => process.env.VUE_APP_REMOTE_URL)
}))
],
optimization: {
splitChunks: {
chunks: 'all',
cacheGroups: {
vendors: {
name: 'chunk-vendors',
test: resolve('node_modules'),
chunks: 'initial'
},
staticAssets: {
name: 'static-assets',
test: resolve('src/assets'),
chunks: 'initial',
priority: 1
},
butterchurn: {
name: 'butterchurn',
test: resolve('butterchurn'),
chunks: 'initial',
priority: 1
},
presets: {
name: 'butterchurn-presets',
test: /presets/,
chunks: 'initial',
priority: 2
}
}
}
}
}
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/Benzolamps/bz-music-we.git
git@gitee.com:Benzolamps/bz-music-we.git
Benzolamps
bz-music-we
bz-music-we
master

搜索帮助