express-systemjs-translate icon indicating copy to clipboard operation
express-systemjs-translate copied to clipboard

Paths no longer work for me...

Open lookfirst opened this issue 8 years ago • 8 comments

Error: express-systemjs-translate: Configuration error. serverRoot is not a parent directory for your jspm configured baseUrl.
    serverRoot: /hub/target/hub-1.0-SNAPSHOT
    baseUrl: /hub/target/

jspm is configured with baseUrl: '/'

translate('/hub/target/hub-1.0-SNAPSHOT', { debug: true })

No matter what I put in for baseUrl, nothing changes.

lookfirst avatar Jul 22 '16 16:07 lookfirst

Are you using jspm and if you do, could you show me the jspm section of your package.json?

Munter avatar Jul 23 '16 07:07 Munter

I'm using jspm and systemjs-builder to do my bundling (via gulp). I have two modes that I support, development and production.

Things may be a bit 'odd' in that:

  1. I use babel to compile to target/js
  2. I'm serving development mode out of target/hub-1.0-SNAPSHOT
  3. There is a symlink from target/js -> target/hub-1.0-SNAPSHOT/js
  4. I'm bundling (with systemjs-builder) several different applications that live under the same root (in the aforementioned js folder).
  5. When I bundle for production, I remove the symlink first and just bundle into the folders directly.
  6. Each separate app loads a different app.js file.
  "jspm": {
    "main": "app.js",
    "directories": {
      "lib": "target/js",
      "baseURL": "target"
    },
    "configFiles": {
      "jspm:browser": "src/main/jspm.browser.js",
      "jspm": "src/main/jspm.config.js"
    },
    "dependencies": {
    },
    "devDependencies": {
    },
    "peerDependencies": {
    },
    "overrides": {
    }
  }

lookfirst avatar Jul 23 '16 07:07 lookfirst

Ok. So what happens here is that I assumed when you use jspm that the configuration will always be correct for your web app, meaning baseUrl and configFile can be reliably extracted from a jspm instance. This doesn't seem to be the case in your setup.

I can try to look into if it's possible to still configure baseUrl and configFile even when using var System = require('jspm').Loader().

With this middleware you should be able to skip your babel toolchain entirely and let systemjs handle it. The done work would be cached in the builder instance in the middleware. One of the primary points of creating this middleware in the first place was tool chain simplification :)

Munter avatar Jul 23 '16 10:07 Munter

I currently need a build step for 'compiling' my angular templates as well... would love to get rid of that too... https://github.com/marklagendijk/gulp-ng-html2js

Your code worked before for me... just sourcemaps were not working. Now nothing works. =)

lookfirst avatar Jul 24 '16 16:07 lookfirst

I recommend staying in v3 until I have time to fix this. I'll look at it later today or tomorrow

Munter avatar Jul 24 '16 16:07 Munter

No worries on timing.... just trying to help give feedback. =)

lookfirst avatar Jul 24 '16 17:07 lookfirst

I really appreciate it. All the feedback I've been getting here has really helped both strengthen the API and discover some corner cases.

Munter avatar Jul 24 '16 18:07 Munter

Ping. =)

lookfirst avatar Aug 01 '16 21:08 lookfirst