Babel


This topic has been reduced to a stub. Discussion continues in the esbuild deep dive.


Try it out

🗑 This refers to functionality removed in skuba v3.15.0.

  1. babel.config.js

    module.exports = {
      presets: [require.resolve('skuba/config/babel')],
    };
    
  2. package.json

    {
      "skuba": {
        "babel": true,
      },
    }
    
  3. tsconfig.json

    {
      "compilerOptions": {
        "isolatedModules": true
      }
    }
    

    (skuba v5.0.0 defaults this option to true.)

  4. …and that’s it!

    # uses Babel instead of tsc
    skuba build
    
    # uses Nodemon + babel-node instead of ts-node-dev
    skuba start
    

Current limitations

🗑 This refers to functionality removed in skuba v3.15.0.

  1. Babel doesn’t support all TypeScript language features.

  2. Module alias support is hardcoded to src.

  3. Build command is hardcoded to input directory src and output directory lib.

  4. The babel-node REPL is fairly primitive. While it can import TypeScript modules, it does not support interactive TypeScript nor modern JavaScript syntax:

    import { someExport } from 'src/someModule';
    // Thrown: [...] Modules aren't supported in the REPL
    
    const { someExport } = require('src/someModule');
    // Thrown: [...] Only `var` variables are supported in the REPL
    
    var { someExport } = require('src/someModule');
    // undefined
    
    var v: undefined;
    // Thrown: [...] Unexpected token