63384774 by 406803045

babel

1 parent 0eb93784
1
1 import Vue from 'vue' 2 import Vue from 'vue'
2 import 'normalize.css/normalize.css' // A modern alternative to CSS resets 3 import 'normalize.css/normalize.css' // A modern alternative to CSS resets
3 import '@/assets/css/index.scss' // global css 4 import '@/assets/css/index.scss' // global css
......
...@@ -15,7 +15,7 @@ export const constantRoutes = [ ...@@ -15,7 +15,7 @@ export const constantRoutes = [
15 const createRouter = () => 15 const createRouter = () =>
16 new Router({ 16 new Router({
17 mode: 'history', // require service support 17 mode: 'history', // require service support
18 base: '/antpublic/', 18 base: '/app/',
19 scrollBehavior: () => ({ y: 0 }), 19 scrollBehavior: () => ({ y: 0 }),
20 routes: constantRoutes 20 routes: constantRoutes
21 }) 21 })
......
...@@ -20,7 +20,9 @@ const cdn = { ...@@ -20,7 +20,9 @@ const cdn = {
20 // 开发环境 20 // 开发环境
21 dev: { 21 dev: {
22 css: [], 22 css: [],
23 js: [] 23 js: [
24 'https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.4.4/polyfill.js'
25 ]
24 }, 26 },
25 // 生产环境 27 // 生产环境
26 build: { 28 build: {
...@@ -37,7 +39,7 @@ const cdn = { ...@@ -37,7 +39,7 @@ const cdn = {
37 } 39 }
38 } 40 }
39 module.exports = { 41 module.exports = {
40 publicPath: process.env.NODE_ENV === 'development' ? '/' : '/antpublic/', 42 publicPath: process.env.NODE_ENV === 'development' ? '/' : '/app/', // 需要区分生产环境和开发环境,不然build会报错
41 outputDir: 'dist', 43 outputDir: 'dist',
42 assetsDir: 'static', 44 assetsDir: 'static',
43 lintOnSave: process.env.NODE_ENV === 'development', 45 lintOnSave: process.env.NODE_ENV === 'development',
...@@ -50,14 +52,13 @@ module.exports = { ...@@ -50,14 +52,13 @@ module.exports = {
50 errors: true 52 errors: true
51 } 53 }
52 }, 54 },
53 55
54 configureWebpack: config => { 56 configureWebpack: config => {
55 // 为生产环境修改配置... 57 // 为生产环境修改配置...
56 if (process.env.NODE_ENV === 'production') { 58 if (process.env.NODE_ENV === 'production') {
57 // externals里的模块不打包 59 // externals里的模块不打包
58 Object.assign(config, { 60 Object.assign(config, {
59 name: name, 61 name: name,
60 // entry:["@babel/polyfill", "./src/main.js"],
61 externals: externals 62 externals: externals
62 }) 63 })
63 } 64 }
...@@ -65,18 +66,9 @@ module.exports = { ...@@ -65,18 +66,9 @@ module.exports = {
65 if (process.env.NODE_ENV === 'development') { 66 if (process.env.NODE_ENV === 'development') {
66 } 67 }
67 }, 68 },
68 // configureWebpack: {
69 // name: name,
70 // resolve: {
71 // alias: {
72 // '@': resolve('src')
73 // }
74 // }
75 // },
76 chainWebpack(config) { 69 chainWebpack(config) {
77 config.plugins.delete('preload') // TODO: need test 70 config.plugins.delete('preload') // TODO: need test
78 config.plugins.delete('prefetch') // TODO: need test 71 config.plugins.delete('prefetch') // TODO: need test
79 // config.entry.app = ["babel-polyfill", resolve('src/main.js')]
80 // alias 72 // alias
81 config.resolve.alias 73 config.resolve.alias
82 .set('@', resolve('src')) 74 .set('@', resolve('src'))
...@@ -88,7 +80,6 @@ module.exports = { ...@@ -88,7 +80,6 @@ module.exports = {
88 */ 80 */
89 config.plugin('html').tap(args => { 81 config.plugin('html').tap(args => {
90 if (process.env.NODE_ENV === 'production') { 82 if (process.env.NODE_ENV === 'production') {
91 console.log(args)
92 args[0].cdn = cdn.build 83 args[0].cdn = cdn.build
93 } 84 }
94 if (process.env.NODE_ENV === 'development') { 85 if (process.env.NODE_ENV === 'development') {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!