代码拉取完成,页面将自动刷新
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
}
}
}
}
}
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。