Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when tsconfig specifies inlineSourceMap: true then no sourcemap is generated #71

Closed
TheRealPiotrP opened this issue Mar 30, 2018 · 6 comments
Labels
kind: bug Something isn't working properly solution: workaround available There is a workaround available for this issue

Comments

@TheRealPiotrP
Copy link

TheRealPiotrP commented Mar 30, 2018

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,
		// ...
	},
        // ...
}
@TheRealPiotrP
Copy link
Author

To be clear, I have a reasonable workaround. I'd only like it to be less difficult to discover. At a minimum, this issue should help others find it...

@ezolenko
Copy link
Owner

ezolenko commented 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.

@lolgesten
Copy link

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?

@agilgur5 agilgur5 added kind: bug Something isn't working properly solution: workaround available There is a workaround available for this issue labels May 22, 2022
@agilgur5
Copy link
Collaborator

agilgur5 commented May 22, 2022

@lolgesten Rollup handles sourcemaps (as other plugins on-chain can further change them), so it makes more sense that related tsconfig options are forced/ignored and the Rollup config is respected instead.

Does setting sourcemap: "inline" in your Rollup config (as mentioned by OP) handle your use-case?

@lolgesten
Copy link

@agilgur5 sorry i don't have my test setup anymore. We decided to go with esbuild in the end.

@agilgur5
Copy link
Collaborator

agilgur5 commented May 23, 2022

@lolgesten thanks for the quick response anyway! Your comment got some upvotes and this issue is linked in the README, so thought it would be good to respond even if it were ~2 years old. Hopefully my response will help another reader in the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working properly solution: workaround available There is a workaround available for this issue
Projects
None yet
Development

No branches or pull requests

4 participants