Lasso Babel Transform

raw JSON →
3.1.1 verified Sat Apr 25 auth: no javascript

A Lasso.js transform that uses Babel to transpile ES6+ code to ES5 for browser bundles. The current stable version is 3.1.1 (supports Babel 7 and Lasso 2+). Release cadence is low; updates are infrequent but maintain compatibility with Lasso and Babel ecosystems. Key differentiators: integrates Babel transpilation directly into Lasso's build pipeline, respects .babelrc / .babelrc-browser per package, and allows global babelOptions override.

error Error: Cannot find module '@babel/core'
cause @babel/core not installed or missing peer dependency.
fix
Run: npm install @babel/core
error Error: Plugin/Preset 'env' is not a function
cause Using Babel 7 preset names with Babel 6 or vice versa.
fix
Use @babel/preset-env for Babel 7 or babel-preset-env for Babel 6.
breaking Version 3.x requires @babel/core (Babel 7). Using Babel 6 with 3.x will fail.
fix Update to @babel/core or use lasso-babel-transform@1 for Babel 6.
deprecated Options like 'babelOptions' override per-package .babelrc; this can cause unexpected overrides.
fix Avoid setting babelOptions unless you intend global override; let .babelrc drive per-package config.
gotcha If no .babelrc, .babelrc-browser, or babel property found in package.json, no transpilation occurs silently.
fix Ensure each package has a valid Babel configuration file or use global babelOptions.
gotcha All files with enabled extensions are transpiled; excluding files must be done via .babelrc 'exclude' pattern.
fix Add 'exclude' array in Babel config to skip specific files/directories.
npm install lasso-babel-transform
yarn add lasso-babel-transform
pnpm add lasso-babel-transform

Configures Lasso to transpile ES6+ JavaScript files using Babel via lasso-babel-transform with global babel options.

const lasso = require('lasso');
const path = require('path');

lasso.configure({
    outputDir: path.join(__dirname, 'static'),
    require: {
        transforms: [
            {
                transform: 'lasso-babel-transform',
                config: {
                    extensions: ['.js', '.es6'],
                    babelOptions: {
                        presets: ['@babel/preset-env']
                    }
                }
            }
        ]
    }
});

lasso.lassoPage({
    name: 'myPage',
    dependencies: [
        path.join(__dirname, 'myModule.js')
    ]
});