Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

babel7 compatibilty #240

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var insertCSSPath = normalize.lib('insert-css')

var hasBabel = true
try {
require('babel-core')
require('@babel/core')
} catch (e) {
hasBabel = false
}
Expand Down
8 changes: 4 additions & 4 deletions lib/compilers/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ var assign = require('object-assign')
var ensureRequire = require('../ensure-require')

var defaultBabelOptions = {
presets: ['es2015'],
plugins: ['transform-runtime']
presets: ['@babel/preset-env'],
plugins: ['@babel/plugin-transform-runtime']
}

var babelRcPath = path.resolve(process.cwd(), '.babelrc')
Expand All @@ -27,7 +27,7 @@ function getBabelRc () {
module.exports = function (raw, cb, compiler, filePath) {
if ((compiler.options.babel || babelOptions) === defaultBabelOptions) {
try {
ensureRequire('babel', ['babel-preset-es2015', 'babel-runtime', 'babel-plugin-transform-runtime'])
ensureRequire('babel', ['@babel/preset-env', '@babel/runtime', '@babel/plugin-transform-runtime'])
} catch (e) {
console.error(e.message)
console.error(
Expand All @@ -39,7 +39,7 @@ module.exports = function (raw, cb, compiler, filePath) {
}

try {
var babel = require('babel-core')
var babel = require('@babel/core')
var options = assign({
comments: false,
filename: filePath,
Expand Down
4 changes: 2 additions & 2 deletions lib/ensure-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module.exports = function (name, deps) {
}
try {
// hack for babel-runtime because it does not expose "main" field
if (req === 'babel-runtime') {
req = 'babel-runtime/core-js'
if (req === '@babel/runtime') {
req = '@babel/runtime/core-js'
}
require.resolve(req)
} catch (e) {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
"vue-template-es2015-compiler": "^1.2.2"
},
"devDependencies": {
"babel-core": "^6.0.0",
"babel-plugin-transform-runtime": "^6.0.0",
"babel-preset-es2015": "^6.0.0",
"babel-runtime": "^6.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/runtime": "^7.0.0",
"browserify": "^13.0.1",
"chai": "^3.5.0",
"coffee-script": "^1.10.0",
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy