Skip to content

Commit

Permalink
feat: specify babel runtime version (#4959)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyy7259 authored and sodatea committed Jan 6, 2020
1 parent 413470d commit 9ec2d34
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/@vue/babel-preset-app/index.js
Expand Up @@ -53,6 +53,7 @@ module.exports = (context, options = {}) => {
}

const runtimePath = path.dirname(require.resolve('@babel/runtime/package.json'))
const runtimeVersion = require('@babel/runtime/package.json').version
const {
polyfills: userPolyfills,
loose = false,
Expand All @@ -78,7 +79,13 @@ module.exports = (context, options = {}) => {
// However, this may cause hash inconsistency if the project is moved to another directory.
// So here we allow user to explicit disable this option if hash consistency is a requirement
// and the runtime version is sure to be correct.
absoluteRuntime = runtimePath
absoluteRuntime = runtimePath,

// https://babeljs.io/docs/en/babel-plugin-transform-runtime#version
// By default transform-runtime assumes that @babel/runtime@7.0.0-beta.0 is installed, which means helpers introduced later than 7.0.0-beta.0 will be inlined instead of imported.
// See https://github.com/babel/babel/issues/10261
// And https://github.com/facebook/docusaurus/pull/2111
version = runtimeVersion
} = options

// resolve targets
Expand Down Expand Up @@ -180,7 +187,9 @@ module.exports = (context, options = {}) => {
helpers: useBuiltIns === 'usage',
useESModules: !process.env.VUE_CLI_BABEL_TRANSPILE_MODULES,

absoluteRuntime
absoluteRuntime,

version
}])

return {
Expand Down

0 comments on commit 9ec2d34

Please sign in to comment.