babel
Showing
3 changed files
with
6 additions
and
14 deletions
| 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', |
| ... | @@ -57,7 +59,6 @@ module.exports = { | ... | @@ -57,7 +59,6 @@ module.exports = { |
| 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') { | ... | ... |
-
Please register or sign in to post a comment