sinclairzx81 / typescript-bundle

A Bundling Tool for TypeScript
MIT License
126 stars 6 forks source link

Invalid mapping #6

Open bbello25 opened 5 years ago

bbello25 commented 5 years ago

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
sinclairzx81 commented 5 years ago

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.

bbello25 commented 5 years ago

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.