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
Tim Neutkens bbc346869e
Remove Typescript helpers in favor of babel helpers (#6087)
There's still a few Typescript helpers in use, but regenerator is added by Babel after this change, as it was already in the bundle it'll drop bundle sizes by quite a bit, eg _app.js becomes half the size.
2019-01-18 22:00:15 +01:00

24 lines
622 B
JavaScript

// 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)
})
}