Skip to content

Commit

Permalink
feat: upgrade to babel 7 + use @vue/babel-preset-app
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 25, 2018
1 parent a74ae5e commit c43c73d
Show file tree
Hide file tree
Showing 5 changed files with 739 additions and 630 deletions.
1 change: 0 additions & 1 deletion lib/app/clientEntry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* global BASE_URL, GA_ID, ga, SW_ENABLED */

import '@temp/polyfill'
import { createApp } from './app'
import { register } from 'register-service-worker'

Expand Down
15 changes: 3 additions & 12 deletions lib/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,16 @@ module.exports = async function prepare (sourceDir) {
const dataCode = `export const siteData = ${JSON.stringify(options.siteData, null, 2)}`
await writeTemp('siteData.js', dataCode)

// 4. generate basic polyfill if need to support older browsers
let polyfillCode = ``
if (!options.siteConfig.evergreen) {
polyfillCode =
`import 'es6-promise/auto'
if (!Object.assign) Object.assign = require('object-assign')`
}
await writeTemp('polyfill.js', polyfillCode)

// 5. handle user override
// 4. handle user override
const overridePath = path.resolve(sourceDir, '.vuepress/override.styl')
const hasUserOverride = fs.existsSync(overridePath)
await writeTemp(`override.styl`, hasUserOverride ? `@import(${JSON.stringify(overridePath)})` : ``)

// 6. handle enhanceApp.js
// 5. handle enhanceApp.js
const enhanceAppPath = path.resolve(sourceDir, '.vuepress/enhanceApp.js')
await writeEnhanceTemp('enhanceApp.js', enhanceAppPath)

// 7. handle the theme enhanceApp.js
// 6. handle the theme enhanceApp.js
await writeEnhanceTemp('themeEnhanceApp.js', options.themeEnhanceAppPath)

return options
Expand Down
7 changes: 1 addition & 6 deletions lib/webpack/createBaseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,7 @@ module.exports = function createBaseConfig ({
.loader('babel-loader')
.options({
presets: [
require.resolve('babel-preset-env'),
require.resolve('babel-preset-stage-2')
],
plugins: [
require.resolve('babel-plugin-transform-vue-jsx'),
require.resolve('babel-plugin-transform-runtime')
require.resolve('@vue/babel-preset-app')
]
})
}
Expand Down
13 changes: 3 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,9 @@
},
"dependencies": {
"autoprefixer": "^8.2.0",
"babel-core": "^6.26.3",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.4",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-2": "^6.24.1",
"@babel/core": "7.0.0-beta.47",
"babel-loader": "8.0.0-beta.3",
"@vue/babel-preset-app": "3.0.0-beta.11",
"cache-loader": "^1.2.2",
"chalk": "^2.3.2",
"chokidar": "^2.0.3",
Expand All @@ -56,7 +51,6 @@
"css-loader": "^0.28.11",
"diacritics": "^1.3.0",
"docsearch.js": "^2.5.2",
"es6-promise": "^4.2.4",
"escape-html": "^1.0.3",
"file-loader": "^1.1.11",
"fs-extra": "^5.0.0",
Expand All @@ -76,7 +70,6 @@
"markdown-it-table-of-contents": "^0.3.3",
"mini-css-extract-plugin": "^0.4.0",
"nprogress": "^0.2.0",
"object-assign": "^4.1.1",
"optimize-css-assets-webpack-plugin": "^4.0.0",
"portfinder": "^1.0.13",
"postcss-loader": "^2.1.5",
Expand Down
Loading

0 comments on commit c43c73d

Please sign in to comment.