Babel usage
Underbase support third-party compilers to run migrations such as Babel, Typescript and ESM.
See this code example.
Instructions
First, ensure you have the following packages installed :
@babel/core
@babel/register
@babel/preset-env
@underbase/cli
Configure your babel.config.js
as the following :
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
};
You can then use Babel to transpile migration files on the fly :
underbase --require @babel/register --config underbase.config.js
Babel + Typescript
To use Babel with Typescript, you have to enable .ts
extension. In order do that, we've created a package which uses @babel/register
.
You still need to have @babel/register
and @babel/preset-typescript
installed.
See this code example.
Instructions
- Install the package
yarn add -D @underbase/babel-register-ts
- Then, you can use your Typescript files
underbase -r @underbase/babel-register-ts migrate 1.0