-
Notifications
You must be signed in to change notification settings - Fork 213
Web preset option to enable sourcemaps in production #676
Comments
So create-react-app takes the approach of generating source maps by default in production too, and then telling the user to handle them as desired during app deployment (eg restricting access via the server config or just removing them) or else they can set an option to disable: Should we should do this too? |
Yes please! |
I think we should also evaluate what source map mode we should use throughout. The webpack devtools docs are quite frustrating tbh (all the options!): Reading the source makes things a little clearer: It seems that the substrings have the following meanings:
(See also https://survivejs.com/webpack/building/source-maps/) Considerations when comparing:
For reference these are the various
|
Questions:
To give some alternatives as to how the options could be presented to the user: Option A... module.exports = {
use: [
[
'@neutrinojs/react',
{
// Always enable sourcemaps, rather than the default of only in development
// (Neutrino picks the most appropriate source-map for each mode)
sourcemaps: true,
}
]
]
}; Option B... module.exports = {
use: [
[
'@neutrinojs/react',
{
sourcemaps: {
// Override Neutrino's default development sourcemap of 'cheap-module-source-map'
development: 'eval',
// Enable sourcemaps in production too.
// Neutrino will use 'source-map' since not overridden.
production: true
}
}
]
]
}; |
How about both, with Maybe we name it devtool: 'auto' // we pick based on environment and preset
// user manually overrides
devtool: {
development: 'cheap-eval-source-map',
production: 'source-map',
none: 'eval'
} |
Meant to say before, for Treeherder, enabling |
If we do enable source-maps by default in production, we should make a note about potential security risks of outputting those source maps publicly. |
Agreed. Though interestingly, CRA's only mention from that point of view (given they enable by default), is this code comment: And the |
This is blocked by #972. |
There are still design decisions here to be made - which are the real blocker IMO. I think perhaps we should still leave sourcemaps off in production (if only so the out of the box speed is competitive), but it would be good to add an easy option to enable them (and at the opinionated optimal setting). |
I propose we:
Still to decide:
|
Currently the Neutrino web preset only enables sourcemaps (specifically
cheap-module-eval-source-map
) in development:https://github.com/mozilla-neutrino/neutrino-dev/blob/e52919b5ebcd694857bb7a5244afe07ca1299fd1/packages/web/index.js#L187
I imagine some people wouldn't want sourcemaps in production (eg non-open-source), however perhaps it would be worth having an option to enable for those who do? (Which would save users having to figure out which sourcemap type is best for production by reading through all of https://webpack.js.org/configuration/devtool/)
The text was updated successfully, but these errors were encountered: