plugin-typescript
plugin-typescript copied to clipboard
Source map files have incorrect path locations
Hi there, I'm getting the wrong path information being generated in my source map files. Details are:
Versions:
[email protected]
[email protected] Dev
[email protected]
[email protected] (and I also tried with 2.2.0 with the same outcome)
Config
- I'm using
jspm bundle app ../public/frontend --source-map-contents - my
jspm.config.jsfile:
paths: {
"github:": "jspm_packages/github/",
"npm:": "jspm_packages/npm/",
},
browserConfig: {
"baseURL": "/frontend"
},
transpiler: "ts",
typescriptOptions: {
"tsconfig": true
},
packages: {
"app": {
"defaultExtension": "ts",
"main": "bootstrap.js",
"meta": {
"*.ts": {
"loader": "ts"
},
"*.css": {
"loader": "text"
},
"*.html": {
"loader": "text"
},
"*.js": {
"loader": "ts"
}
}
},
etc....
- my
tsconfig.jsonfile:
"compilerOptions": {
"allowJs": true,
"module": "es2015",
"target": "es5",
"moduleResolution": "classic",
"noImplicitAny": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"rootDirs": [ /** these correspond to my jspm package entries **/
"./apiActions",
"./app",
"./components",
"./common",
"./controlPanelApp",
"./pectin",
"./place",
"./tests/spec"
],
etc...
Result
The sources: entry in app.map.js has:
- files from jspm_packages at the correct path. .i.e
"../../frontend/jspm_packages/npm/[email protected]/helpers/isPrimitive.js",
- the first of my source files in the correct location
"../../frontend/app/templates.js",
- but the remainder of files from my packages are all at the root, i.e.
"../../frontend/clock.module.ts",
(it should be at ../../frontend/common/clock/clock.module.ts)
Any ideas?
I think this could be due to the rootDirs option, what exactly is it for? As this setting is related to module resolution, and runtime module resolution is handled entirely by systemjs, it may be that the plugin should not pass this option through when transpiling files.
Have you tried using the paths option instead?
Also see https://github.com/Microsoft/TypeScript/issues/12246 as it sounds very similar.
Excellent, thanks for the pointers. I'll dig a bit further into the documentation and make sure I'm not just confused about how it should work.