Former-commit-id: 8477119fd5f1b00ed475d5c1d5f58fb492242ce4 [formerly 8477119fd5f1b00ed475d5c1d5f58fb492242ce4 [formerly 8477119fd5f1b00ed475d5c1d5f58fb492242ce4 [formerly 8477119fd5f1b00ed475d5c1d5f58fb492242ce4 [formerly e82e470908f00592d5c37f6b4d10962a707d7cda [formerly d5a2ba18914a998a630f8bd918576b86fc532b69]]]]] Former-commit-id: 53b9ca1133447d78cbc2d4cddcd18db27e0b27e3 Former-commit-id: c1fc2c2a96a6e90df1f64472929e251f7492c2d5 Former-commit-id: 03fbb8422c4220c8f0e3c31ccd01b18f9319d635 [formerly ac5c11121841be6a2e16b8bfb081b1d03d042f2e] Former-commit-id: 5ba3172089d5f347542c7ffc088b6c1848ca6db7 Former-commit-id: ac2741a5d88ca3bcbaffaf5d9a7c124457f6121c Former-commit-id: a9a1a889b3881f46ab6c1f3216d3392240eeec86 Former-commit-id: b09071b2a852488f288e601c1aa2c92452c5974e Former-commit-id: 29ef11c5e19601331aff01fff968b475fed7c0f4
68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
const path = require('path')
|
|
|
|
// 拼接路径
|
|
function resolve (dir) {
|
|
return path.join(__dirname, dir)
|
|
}
|
|
|
|
// 基础路径 注意发布之前要先修改这里
|
|
let baseUrl = '/'
|
|
// 演示项目自动构建使用
|
|
if (process.env.VUE_APP_TRAVIS === 'TRUE') baseUrl = '/d2-admin/'
|
|
|
|
module.exports = {
|
|
baseUrl: baseUrl, // 根据你的实际情况更改这里
|
|
lintOnSave: true,
|
|
devServer: {
|
|
publicPath: baseUrl // 和 baseUrl 保持一致
|
|
},
|
|
// 默认设置: https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-service/lib/config/base.js
|
|
chainWebpack: config => {
|
|
// 解决 cli3 热更新失效 https://github.com/vuejs/vue-cli/issues/1559
|
|
config.resolve
|
|
.symlinks(true)
|
|
// markdown
|
|
config.module
|
|
.rule('md')
|
|
.test(/\.md$/)
|
|
.use('text-loader')
|
|
.loader('text-loader')
|
|
.end()
|
|
// i18n
|
|
config.module
|
|
.rule('i18n')
|
|
.resourceQuery(/blockType=i18n/)
|
|
.use('i18n')
|
|
.loader('@kazupon/vue-i18n-loader')
|
|
.end()
|
|
// svg
|
|
const svgRule = config.module.rule('svg')
|
|
svgRule.uses.clear()
|
|
svgRule
|
|
.include
|
|
.add(resolve('src/assets/svg-icons/icons'))
|
|
.end()
|
|
.use('svg-sprite-loader')
|
|
.loader('svg-sprite-loader')
|
|
.options({
|
|
symbolId: 'd2-[name]'
|
|
})
|
|
.end()
|
|
// image exclude
|
|
const imagesRule = config.module.rule('images')
|
|
imagesRule
|
|
.test(/\.(png|jpe?g|gif|webp|svg)(\?.*)?$/)
|
|
.exclude
|
|
.add(resolve('src/assets/svg-icons/icons'))
|
|
.end()
|
|
// 重新设置 alias
|
|
config.resolve.alias
|
|
.set('@', resolve('src'))
|
|
// babel-polyfill 加入 entry
|
|
const entry = config.entry('app')
|
|
entry
|
|
.add('babel-polyfill')
|
|
.end()
|
|
}
|
|
}
|