1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- const path = require('path');
- function resolve(dir) {
- return path.join(__dirname, dir);
- }
- const cdn = {
- js: [
- // vue 必须优先加载(生产环境使用最小运行时版本runtime.min, 其他环境使用全版本)
- process.env.NODE_ENV !== 'production'
- ? 'https://cdn.bootcss.com/vue/2.6.10/vue.js' : 'https://cdn.bootcss.com/vue/2.6.9/vue.runtime.min.js',
- // vue-router
- 'https://cdn.bootcss.com/vue-router/3.0.6/vue-router.min.js',
- // element js
- 'https://unpkg.com/element-ui/lib/index.js'
- ],
- css: [
- // element css
- 'https://unpkg.com/element-ui/lib/theme-chalk/index.css'
- ]
- };
- module.exports = {
- lintOnSave: false,
- chainWebpack: (config) => {
- // 通过 html-webpack-plugin注入到 index.html
- config.plugin('html').tap(args => {
- args[0].cdn = cdn;
- return args;
- });
- },
- configureWebpack: {
- resolve: {
- alias: {
- '@': resolve('src'),
- 'view': resolve('src/view'),
- 'assets': resolve('src/assets'),
- 'common': resolve('src/common')
- }
- },
- externals: {
- Vue: 'vue',
- 'router': 'router',
- 'ElementUI': 'element-ui'
- }
- },
- devServer: {
- host: '0.0.0.0',
- port: 8080,
- https: false,
- hotOnly: false,
- proxy: null, // 设置代理
- before: app => {
- }
- }
- };
|