-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvue.config.js
69 lines (63 loc) · 1.79 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const { defineConfig } = require('@vue/cli-service')
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path')
const isProduction = process.env.NODE_ENV === 'production'
const resolve = (dir) => path.resolve(__dirname, dir)
module.exports = defineConfig({
publicPath: './',
outputDir: path.resolve(__dirname, './dist/lib'),
transpileDependencies: true,
productionSourceMap: false,
chainWebpack(config) {
isProduction && config.plugins.delete('html') // 删除HTMLPlugin
isProduction && config.plugins.delete('copy')
},
css: {
extract: {
filename: isProduction ? 'mini-vue-barrage.css' : '[name].css',
chunkFilename: '[name].css',
},
loaderOptions: {
postcss: {
postcssOptions: {
plugins: [
require('postcss-preset-env')({
browsers: [
"defaults",
"not ie < 11", // 版本不小于 ie 11的
"last 2 versions", //并且他的前两个版本
"> 1%",// 将市场份额大于1%的浏览器
"iOS 7",// ios大于 7
"last 3 iOS versions" // ios的前三版本
]
})
]
}
}
}
},
configureWebpack: {
entry: isProduction ? './package/index.js' : './src/main.js',
output: {
filename: isProduction ? 'index.js' : '[name].js',
library: {
name: 'miniVueBarrage',
type: 'umd'
},
},
plugins: [
isProduction && new CopyWebpackPlugin({
patterns: [
{
from: './package/package.json',
to: resolve('./dist/package.json'),
},
{
from: './README.md',
to: resolve('./dist/README.md'),
}
]
})
]
}
})