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

Source map files have incorrect path locations #193

Open
pietschy opened this issue Feb 20, 2017 · 3 comments
Open

Source map files have incorrect path locations #193

pietschy opened this issue Feb 20, 2017 · 3 comments

Comments

@pietschy
Copy link

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.js file:
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.json file:
"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?

@frankwallis
Copy link
Owner

frankwallis commented Feb 26, 2017

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?

@frankwallis
Copy link
Owner

Also see microsoft/TypeScript#12246 as it sounds very similar.

@pietschy
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants