Files
frost-navigation/vue.config.js

66 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-02-06 23:36:46 +08:00
const path = require('path');
const { defineConfig } = require('@vue/cli-service');
const { npm_package_name: packageName } = process.env;
function addStyleRes({ config = null, processor = '', patterns = [] }) {
if (!config) {
return;
}
const rule = config.module.rule(processor);
const types = ['normal', 'normal-modules', 'vue', 'vue-modules'];
types.forEach((type) => {
rule.oneOf(type)
.use('style-resources-loader')
.loader('style-resources-loader')
.options({ patterns });
});
}
2021-09-24 23:40:29 +08:00
if (packageName) {
process.title = packageName;
}
2021-02-06 23:36:46 +08:00
module.exports = defineConfig({
2021-02-06 23:36:46 +08:00
assetsDir: 'static',
outputDir: 'dist',
publicPath: './',
productionSourceMap: false,
transpileDependencies: false,
chainWebpack: (config) => {
addStyleRes({
config,
processor: 'less',
patterns: [
path.resolve(__dirname, 'src/assets/css/variable.less'),
]
});
},
devServer: {
host: '0.0.0.0',
port: 9005,
},
2021-02-06 23:36:46 +08:00
pages: {
mainPage: {
// 入口
entry: 'src/main.js',
// 模板来源
template: 'public/index.html',
// 在 dist 的输出
filename: 'index.html',
// 标题
title: 'Frost 网址导航',
// 包含的块
2021-09-24 23:40:29 +08:00
chunks: ['chunk-common', 'chunk-vendors', 'mainPage'],
},
2021-02-06 23:36:46 +08:00
},
});