Enabling Source Maps

Enabling Source Maps

Source maps allow browsers to access the original code related to some asset (e.g. the Sass code that was compiled to CSS or the TypeScript code that was compiled to JavaScript). Source maps are useful for debugging purposes but unnecessary when executing the application in production.

Encore’s default webpack.config.js file enables source maps in the dev build:

  1. // webpack.config.js
  2. // ...
  3. Encore
  4. // ...
  5. .enableSourceMaps(!Encore.isProduction())
  6. ;

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.