You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow the --sourceMap command line flag to be used in build mode to act as a global override for the tsconfig file(s). So if any tsconfig project files enable source map generation, then setting this flag from the command line will disable it for the entire build (including referenced tsconfigs).
This type of override behavior could also be supported for other boolean command line flags, such as --skipLibCheck and --removeComments. Essentially, flags that affect the speed or output of file generation but not affecting language parsing or interpretation.
Should override the "sourceMap" config in the tsconfig.base.json and never output source maps.
💻 Use Cases
When building a TypeScript project for release on the NPM registry, often you'll want to skip generating source maps unless you plan on including the source .ts files along with the .js.map files. If you simply omit including the .js.map files in your package, then tools like Webpack will complain that it can't find the source map files. If you try including the .js.map files in your package, then you'll start getting warnings from Webpack that it can't find the source .ts files. So you end up having to include the source code in your release packages on NPM. This results in bloated release download sizes.
A solution for those projects with single tsconfig file builds is to create a second tsconfig file that extends your main tsconfig file and sets the sourceMap config to false. However, this problem and suggestion isn't about projects with simple builds. It's about complex "solution-style" builds heavily utilizing project references where it's not feasible to have an auxiliary tsconfig file alongside each of your main tsconfig files.
If the option to globally override a configuration setting was available, then you could leave the sourceMap config set to true for development and debug, and in a "prepublishOnly" script in your package.json you could compile your code with source maps completely disabled for release publishing.
The text was updated successfully, but these errors were encountered:
Suggestion
Currently, the
--sourceMap
command line flag does not work when running in build mode.🔍 Search Terms
source map command line build mode tsconfig solution
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
Allow the
--sourceMap
command line flag to be used in build mode to act as a global override for the tsconfig file(s). So if any tsconfig project files enable source map generation, then setting this flag from the command line will disable it for the entire build (including referenced tsconfigs).This type of override behavior could also be supported for other boolean command line flags, such as
--skipLibCheck
and--removeComments
. Essentially, flags that affect the speed or output of file generation but not affecting language parsing or interpretation.📃 Motivating Example
./tsconfig.base.json:
./src/tsconfig.json
Should override the "sourceMap" config in the
tsconfig.base.json
and never output source maps.💻 Use Cases
When building a TypeScript project for release on the NPM registry, often you'll want to skip generating source maps unless you plan on including the source
.ts
files along with the.js.map
files. If you simply omit including the.js.map
files in your package, then tools like Webpack will complain that it can't find the source map files. If you try including the.js.map
files in your package, then you'll start getting warnings from Webpack that it can't find the source.ts
files. So you end up having to include the source code in your release packages on NPM. This results in bloated release download sizes.A solution for those projects with single tsconfig file builds is to create a second tsconfig file that extends your main tsconfig file and sets the
sourceMap
config tofalse
. However, this problem and suggestion isn't about projects with simple builds. It's about complex "solution-style" builds heavily utilizing project references where it's not feasible to have an auxiliary tsconfig file alongside each of your main tsconfig files.If the option to globally override a configuration setting was available, then you could leave the
sourceMap
config set totrue
for development and debug, and in a "prepublishOnly" script in yourpackage.json
you could compile your code with source maps completely disabled for release publishing.The text was updated successfully, but these errors were encountered: