For the complete documentation index, see llms.txt. This page is also available as Markdown.

Rollup

Applies to: applications and libraries bundled directly with Rollup. Vite uses Rollup for production builds; see Vite.

Step 1: Source maps

// rollup.config.mjs
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';

export default {
  input: 'src/main.js',
  output: {
    dir: 'dist',
    format: 'es',        // or 'iife' for a single classic script
    sourcemap: true,     // or 'hidden'
  },
  plugins: [resolve(), terser()],
};

Every plugin that transforms code (TypeScript, Babel, terser) must pass source maps through; most do by default. Check with dryRun that methods resolve to src/....

Step 2: Build, scan and instrument

  • format: 'es': keep --es6Modules. format: 'iife' or 'umd': remove it.

  • Output with .cjs extensions is not scanned by default; set SL_fileExtensions=.js,.mjs,.cjs.

Libraries used by other applications

A shared component library bundled with Rollup and loaded by several applications can be:

  • its own build (its own config and scan, instrumented copy published to the test environment), when it is deployed separately, for example as a micro-frontend or a CDN script; see Micro-frontends;

  • part of each application's bundle, when the applications import it from node_modules. It is then covered only if its source maps reach the application's bundle and it is not excluded by .slignore.instrument.

Last updated

Was this helpful?