typescript-bundle icon indicating copy to clipboard operation
typescript-bundle copied to clipboard

Invalid mapping

Open bbello25 opened this issue 6 years ago • 2 comments
trafficstars

Hello, I am not sure if this is issue but at least I try. Problem is that debugger seems to stop like 5-10 lines after it should. So if I step into bundled code it show execution point on wrong place.

tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es2015",
    "declaration": true,
    "sourceMap": true,
    "declarationMap": true,
    "outDir": "./dist",
    "lib": [ "es2015", "dom"]
  },
  "include": ["src/**/*"]
}

command

tsc-bundle .\tsconfig.json --exportAs Foo

src folder contains multiple files with top level file index.ts containing just one line export { CemsLogger } from './CemsLogger';

index.html

...
    <script src="./bundle.js"></script>
    <script src="./main.js"></script>
...

main.js

const { CemsLogger } = Foo
... // CemsLogger usage

bbello25 avatar Mar 03 '19 18:03 bbello25

Hi,

Yes, this tool currently doesn't support source map transformations. The source maps emitted by the TypeScript compiler are almost assured to be out of sync with the output bundle. TypeScript-Bundle currently only works on the emitted JS content from the compiler but it leaves the other build artefacts (source maps and declaration files) as they are.

Thanks for raising this though. I'll leave this issue open as both source maps and declaration bundling are on my list of things to take a look at in the future.

sinclairzx81 avatar Mar 03 '19 21:03 sinclairzx81

Thanks for quick answer, it confused me because after I ran command it creates bundle also from types and source maps .. but as I mentioned they were improper.

bbello25 avatar Mar 04 '19 17:03 bbello25