question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

when tsconfig specifies `inlineSourceMap: true` then no sourcemap is generated

See original GitHub issue

What happens and why it is wrong

in my tsconfig.json I have inlineSourceMap: true. I also configured rollup to use sourcemap: 'inline'. Rollup builds occur without issue, but my resultant .js file contained an inline sourcemap for non-ts assets only. After much experimentation I found that I can re-enable sourceMaps for TS with the following configuration:

    typescript({
        tsconfigOverride: {
            compilerOptions: {
                sourceMap: true,
                inlineSourceMap: false,

This is not intuitive. I’ve already expressed that I want sourcemaps, and that I want rollup to generate an inline sourcemap. The plugin should ideally respect the inlineSourceMap option in tsconfig.json.

If this is not feasible [likely because it’s hard to scrape out inline source maps from tsc output] then there should be an error displayed and rollup should fail, telling the user they must disable inlineSourceMap and enable sourceMap in their typescript overrides.

Environment

Not relevant

Versions

  • typescript: 2.7.2
  • rollup: 0.57.1
  • rollup-plugin-typescript2: 0.12.0

rollup.config.js

I’m only including the relevant portion.

Original:

    typescript({
        tsconfigOverride: {
            compilerOptions: {
                module: "ES2015"
            }
        }
    }),

With Workaround:

    typescript({
        tsconfigOverride: {
            compilerOptions: {
                sourceMap: true,
                inlineSourceMap: false,
                module: "ES2015"
            }
        }
    }),

tsconfig.json

{
	"compilerOptions": {
		// ...
		"inlineSourceMap": true,
		// ...
	},
        // ...
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
lolgestencommented, Jun 2, 2020

My use case is developer mode with rollup:

  • rollup-plugin-typescript2 + rollup format: 'es' and preserveModules: false
  • use <script type="module" to load modules from page.

With inlineSourceMaps: true I can get my typescript source also in this dev mode, but the force setting to false means I need to use the OP override.

@ezolenko care to elaborate why forcing inlineSourceMap to false would be wanted behavior?

1reaction
ezolenkocommented, Apr 6, 2018

inlineSourceMap looks like another candidate for being forcefully overridden to false. I don’t think there is a valid case where it being set to true would do anything useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TSConfig Reference - Docs on every TSConfig option
Intro to the TSConfig Reference. A TSConfig file in a directory indicates that the directory is the root of a TypeScript or JavaScript...
Read more >
typescript - --inlineSourceMap or --sourceMap in tsconfig.json
The option --sourceMap tells the compiler that you want the source map generation. The next question is if you want them as separate...
Read more >
Emitting TypeScript Source Maps | Building SPAs - Carl Rippon
There is a compilation option called inlineSourceMap that will put the source map inside the transpiled JavaScript file. Let's explore this.
Read more >
Debug a JavaScript or TypeScript app - Visual Studio (Windows)
js files. The location specified is embedded in the source map to direct the debugger to the location of the .map files. sourceMap:...
Read more >
Using Source Maps - ticehurst.com
sourceMap : Generates corresponding .map file. sourceRoot: Specifies the location where debugger should locate TypeScript files instead of source locations. Use ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found