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

webpack

Applies to: applications with their own webpack.config.js (webpack 4 or 5). Create React App, Vue CLI and the Angular webpack builder are covered on their framework pages.

Step 1: Source maps

// webpack.config.js
module.exports = {
  mode: 'production',
  devtool: 'source-map',   // or 'hidden-source-map'
  // ...
};

devtool value

Works with SeaLights?

source-map, hidden-source-map

Yes. Full maps with columns, in .map files next to the bundles.

inline-source-map

Yes, but the map stays inside the deployed bundle unless you rebuild.

nosources-source-map

Not recommended: the maps carry no source content.

cheap-*

No: line-only maps. The dashboard shows Detected source-maps without column information.

eval, eval-*

No: no source map files; code is wrapped in eval.

false / not set in production

No source maps.

Step 2: Build, scan and instrument

printf '%s' "$SEALIGHTS_AGENT_TOKEN" > sltoken.txt
npm ci
npx webpack --mode production

npx slnodejs config --tokenFile sltoken.txt --appName my-web-app \
  --branchName "$BRANCH_NAME" --buildName "$BUILD_NUMBER"
npx slnodejs scan --tokenFile sltoken.txt --buildSessionIdFile buildSessionId \
  --scanDir dist --scmType git \
  --instrumentForBrowsers --outputPath sl_dist \
  --labId qa-env --excludeSourceMapFiles skipCopy
  • Use the folder in output.path as --scanDir.

  • Add --es6Modules only if you build ES module output (experiments.outputModule: true with output.module: true). Default webpack output is classic scripts.

webpack-specific notes

Topic
What to do

Vendor chunk (splitChunks → vendors~*.js)

Exclude it from the scan in .slignore (**/vendors*.js), or list the packages in .slignore.instrument.

webpack:/// paths in the coverage tree

Framework-generated sources appear as webpack:/.... Remove them from the scan result with .slignore.generated containing webpack:/**.

Module Federation

Each remote is its own build; see Micro-frontends.

output.publicPath set to a CDN

With --splitPreambleIntoFile, pass the CDN folder as a full URL in --preambleFileUrl.

Last updated

Was this helpful?