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

can't override baseURL #224

Closed
lookfirst opened this Issue Jul 10, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@lookfirst
Contributor

lookfirst commented Jul 10, 2015

trying to get build working again with latest stuff...

jspm 16.b3
builder 12

I can't seem to override baseURL anymore, even though this is an example in the builder/README! =(

[11:20:37] TypeError: baseURL should only be configured once and must be configured first.
  at SystemJSNodeLoader.SystemJSLoader.config (/Users/jon/checkout/gearlaunch/hub/node_modules/systemjs-builder/node_modules/systemjs/dist/system.src.js:1388:13)
  at Builder.config (/Users/jon/checkout/gearlaunch/hub/node_modules/systemjs-builder/lib/builder.js:213:10)
  at /Users/jon/checkout/gearlaunch/hub/gulpfile.babel.js:165:11
  at lib$rsvp$$internal$$tryCatch (/Users/jon/checkout/gearlaunch/hub/node_modules/systemjs-builder/node_modules/rsvp/dist/rsvp.js:489:16)
  at lib$rsvp$$internal$$invokeCallback (/Users/jon/checkout/gearlaunch/hub/node_modules/systemjs-builder/node_modules/rsvp/dist/rsvp.js:501:17)
  at lib$rsvp$$internal$$publish (/Users/jon/checkout/gearlaunch/hub/node_modules/systemjs-builder/node_modules/rsvp/dist/rsvp.js:472:11)
  at lib$rsvp$asap$$flush (/Users/jon/checkout/gearlaunch/hub/node_modules/systemjs-builder/node_modules/rsvp/dist/rsvp.js:1290:9)
  at process._tickCallback (node.js:355:11)

config.js:

System.config({
  "defaultJSExtensions": true,
  "transpiler": "babel",
  "babelOptions": {
    "optional": [
      "runtime"
    ]
  },
  "paths": {
    "github:*": "../../jspm_packages/github/*",
    "npm:*": "../../jspm_packages/npm/*"
  }
});
let bundler = (app) => {
    let builder = new Builder();

    return builder.loadConfig('src/main/config.js').then(function() {
        builder.config(
            {
                baseURL: 'file:' + process.cwd() + '/target',
                paths: {
                    'github:*': '../jspm_packages/github/*.js',
                    'npm:*': '../jspm_packages/npm/*.js'
                }
            }
        );
        return builder.buildSFX('js/' + app + '/app', path.war + '/js/' + app + '/' + app + '-bundle.js', {minify: false, sourceMaps: false});
    });
}
@nathanboktae

This comment has been minimized.

Show comment
Hide comment
@nathanboktae

nathanboktae Jul 10, 2015

I also saw this issue. Turns out you can bypass this assertion via this hacky method:

var Builder = require('systemjs-builder')
var builder = new Builder('./')

var baseURL = builder.loader.baseURL

builder.loadConfig('system.config.js')
  .then(function() {
    builder.loader.baseURL = baseURL
    // .... builder.build ....
  })

This assert seems unnecessary.

nathanboktae commented Jul 10, 2015

I also saw this issue. Turns out you can bypass this assertion via this hacky method:

var Builder = require('systemjs-builder')
var builder = new Builder('./')

var baseURL = builder.loader.baseURL

builder.loadConfig('system.config.js')
  .then(function() {
    builder.loader.baseURL = baseURL
    // .... builder.build ....
  })

This assert seems unnecessary.

@guybedford

This comment has been minimized.

Show comment
Hide comment
@guybedford

guybedford Jul 11, 2015

Member

For jspm it is advisable to do:

var Builder = require('jspm').Builder;

// ...

It will then come with all the correct config.

Member

guybedford commented Jul 11, 2015

For jspm it is advisable to do:

var Builder = require('jspm').Builder;

// ...

It will then come with all the correct config.

@lookfirst

This comment has been minimized.

Show comment
Hide comment
@lookfirst

lookfirst Jul 11, 2015

Contributor

closing, moving discussion to #225

Contributor

lookfirst commented Jul 11, 2015

closing, moving discussion to #225

@lookfirst lookfirst closed this Jul 11, 2015

@rolaveric

This comment has been minimized.

Show comment
Hide comment
@rolaveric

rolaveric Aug 7, 2015

The var Builder = require('jspm').Builder; hint should get added to the readme for JSPM users.

rolaveric commented Aug 7, 2015

The var Builder = require('jspm').Builder; hint should get added to the readme for JSPM users.

@guybedford

This comment has been minimized.

Show comment
Hide comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment