1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/packages/next/taskfile-babel.js

24 lines
622 B
JavaScript
Raw Normal View History

// taskr babel plugin with Babel 7 support
// https://github.com/lukeed/taskr/pull/305
'use strict'
const transform = require('@babel/core').transform
module.exports = function (task) {
task.plugin('babel', {}, function * (file, opts) {
const options = {
...opts
}
options.filename = file.base
options.plugins = [
require('@babel/plugin-syntax-dynamic-import'),
...(options.plugins || [])
]
options.babelrc = false
options.configFile = false
options.babelrcRoots = false
const output = transform(file.data, options)
file.data = Buffer.from(output.code)
})
}