How to change sourcemap folder on Sage 10?

Hello, everyone. I have a request from the security team, I have to change the folder for JS sourcemap files.

So, I found couple of solutions for webpack, but I cannot optimize them for Sage bud.config file.

For example, I see that we can use a webpack plugin
SourceMapDevToolPlugin, but I don’t understand how to use it in bud file. Here is the link with a solution on webpack

This describes how to add a webpack plugin to bud (wrap it as a bud extension):

(From documentation page above)

bud.js extensions are a superset of Webpack plugins. This means that you can add basically any Webpack plugin as demonstrated above.

So you would wrap the desired SourceMapDevToolPlugin plugin as a bud extension.

It would be great if you could also publish this as a npm package, so it can be easily added simply by installing a npm package.

1 Like

Thanks for the answer. I will try to create a solution. Is there some example of a separate npm package of bud extension? It will be really useful if someone provides some references because I am not see something similar in the docs.

The @roots/bud monorepo contains all the core bud extension packages, e.g. @roots/bud-sass:

Some discourse user just made a bud extension to extract editor styles:

1 Like