fix ts sourceMap warning on prod build
This PR will change the following config
output: {sourcemap: true}
output: {sourcemap: !production}
It will remove the negation on sourceMap and removes the following warning:
(!) Plugin typescript: @rollup/plugin-typescript: Typescript 'sourceMap' compiler option must be set to generate source maps.
Fixes #174
Thanks, but this is the wrong fix, since this means there's not generation of source maps in dev mode anymore, where you arguably need them more. The right fix (I think, haven't tested it) would be to set this line to !production .
Thanks, but this is the wrong fix, since this means there's not generation of source maps in dev mode anymore, where you arguably need them more. The right fix (I think, haven't tested it) would be to set this line to
!production.
you are indeed right, I changed my Pull request to output: {sourcemap: !production}
With that it is fixed
Question remains if that is a desired default. I'd say yes because source maps are not of much use in production usually, but it is definetly a change other maintainers need to approve on. @Conduitry @antony thoughts?
Disabling prod sourcemaps by default for the sake of this warning seems wrong. Regardless of whether we want to have them by default, if someone reenabled them, they'd be again faced with this warning.
What does this warning actually indicate? Is there something wrong with the produced sourcemaps? Is there some other setting that needs to be enabled?
The warning is a result of sourcemaps being disabled for TypeScript, while being enabled for Rollup as a whole. That's a mismatch and therefore it prints a warning - but it's not more than that, it will bundle. I think it would be nice to align the TS config for sourcemaps with that of the general rollup config though. So the alternative would be to set all these to true in the TS script instead of !production .
Right, it'll bundle, but if TS sourcemaps are disabled, do the final sourcemaps only point back to the JS versions of everything? That seems like the real issue that should be addressed that the warning is telling us about.
Setting it to true in tsconfig.json sounds reasonable.
If we do want to make it dynamic at the TS step, can we pass in tsconfig overrides to the preprocessor and to the TypeScript compiler?
@Conduitry @dummdidumm How can I support here?
I currently lean towards replacing all !production occurences in the TS script with true . That way people will always get the source maps (also when building for production, which matches the template without JS), and the user can still decide if he wants to upload those sourcemaps.