seek-oss / sku

Front-end development toolkit
https://seek-oss.github.io/sku
MIT License
480 stars 35 forks source link

sku v13: Set `sourceMapsProd` default value to `true` #979

Closed askoufis closed 2 months ago

askoufis commented 3 months ago

We should make this the default to align with our recommended behaviour of publishing production sourcemaps.

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: 5ec116e0529c80855644ce0fecaf9a8436dfa4eb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---- | ----- | | sku | Major |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

askoufis commented 2 months ago

Updated the docs and changeset to mention potential heap memory exhaustion that can result from prod source maps, as well as a way to mitigate the issue. This info was added after it was raised internally that production source maps can be quite expensive.

Instead of just documenting the issue, one way to reduce friction for users could be to set NODE_OPTIONS=--max-old-space-size=4096 in sku's bin file so consumers don't have to set it themselves. In cases where consumers need to increase the limit, we could also provide an environment variable to allow overriding our set value. However, this feels a bit redundant when a consumer can just set the option themselves from the get go.

Another option could be to run the webpack build in a separate process, so sku can directly control its --max-old-space-size. This isn't really feasible though because we use a programmatic webpack config, so running it in a separate process would be tricky (we can't just run the CLI and point it to a file). It also has the same issue where we need to allow configuring the memory amount.

Overall I'm happy with just documenting this for now, and if it results in a significant number of internal support issues, we can do something about it then.

There's also room to tweak the specific sourcemap type we use if we want to trade off a bit of accuracy for better performance.