These are chat archives for systemjs/systemjs

16th
Jul 2015
Anton Moiseev
@antonmoiseev
Jul 16 2015 17:05

Guys, is it possible to configure SystemJS to load all files in the project with ts extension?
This is my config file:

System.config({
  "baseURL": "/",
  "defaultJSExtensions": true,
  "transpiler": "typescript"
  //...
})

If I set defaultJSExtensions to false and explicitly specify System.import('main.ts') it breaks some 3rd-party dependencies. The only way I currently found is to add a package configuration:

"packages": {
  "app": {
    "defaultExtension": "ts",
    "main": "main"
  }
}

But I'd rather not to introduce a sub-directory for all my TS code.

Rob Wormald
@robwormald
Jul 16 2015 19:29
@antonmoiseev that's more or less exactly how i do it
and surely you want at least one subdir, since you'll have tests and stuff
Anton Moiseev
@antonmoiseev
Jul 16 2015 21:11
@robwormald thank you. Good point about tests. Originally I was planning to have two top level folders - one for the app and one for the tests (say app/ and tests/). Now I end up having a nested folder src/appfor the app's code. So tests should probably go to src/testsfor consistency and simpler SystemJS configuration reasons.
Rob Wormald
@robwormald
Jul 16 2015 21:13
i do /src and /test, and then use paths/packages to remap src/ -> app/ (like a virtual dir)
Anton Moiseev
@antonmoiseev
Jul 16 2015 21:18
thanks, will keep it mind. I'm currently quite content with the development environment, but haven't started to set up a build script yet. So probably I'll adjust the structure. Generally I try to add minimum custom configuration and keep everything as simple as possible.
Rob Wormald
@robwormald
Jul 16 2015 21:19
the packages config in the beta works well for this
app: { main: app.js } paths: { src : app } then you can just System.import('app')
Anton Moiseev
@antonmoiseev
Jul 16 2015 21:25
I don't get why you need paths: {src: 'app'}. Seems like app: {main: 'app.js'} already does everything necessary to load with System.import('app')
Nate Mara
@natemara
Jul 16 2015 23:50

I would also like an answer to this. The duplication of paths in the paths and packages section seems confusing to me. I may be missing something about this, but I have the following section in my config:

 "paths": {
    "github:*": "jspm_packages/github/*",
    "npm:*": "jspm_packages/npm/*",
    "app": "src/"
  },
  "packages": {
    "src": {
      "main": "main",
      "defaultExtension": "ts"
    }
  }

The entrypoint for my app is src/main.ts, but when I do System.import('app');, it tries to import src/

Rob Wormald
@robwormald
Jul 16 2015 23:53
hold on, let me set up a plunk for y'all
@natemara @antonmoiseev