Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Not able to create bundle with builder when I import json file #42

Closed
martinmicunda opened this issue Jan 10, 2015 · 10 comments
Closed

Comments

@martinmicunda
Copy link

When I import json file (e.g. import abc from './abc.json!') in my code I am not able to build bundle with builder as I am getting below error.

NOTE: I am not getting any error when I am using jspm command e.g. jspm bundle-sfx app/bootstrap build.js and bundle is created successfully.

Gulp Task Code:

var builder = require('systemjs-builder');
builder.reset();

builder.loadConfig('./src/jspm.conf.js')
    .then(function() {
        builder.loader.baseURL = path.resolve('./src/');
        builder.buildSFX('app/bootstrap', paths.tmp.scripts + 'bootstrap.js', { sourceMaps: true, config: {sourceRoot: 'src/.tmp/scripts/'} })
            .then(function() {
                return cb();
            })
            .catch(function(ex) {
                cb(new Error(ex));
            });
    });

Error:

Error: Error loading "app/components/employee/fixtures/employee_1.json!github:systemjs/plugin-json@0.1.0" at <unknown>
Error loading "app/components/employee/fixtures/employee_1.json!github:systemjs/plugin-json@0.1.0" from "app/bootstrap" at file:/Users/martinmicunda/projects/employee-scheduling/ui/src/app/bootstrap.js
Error loading "github:systemjs/plugin-json@0.1.0" at github:systemjs/plugin-json@0.1.0.js
Only file URLs of the form file: allowed running in Node.
    at /Users/martinmicunda/projects/employee-scheduling/ui/gulpfile.js:295:24
    at promiseHandle (/Users/martinmicunda/projects/employee-scheduling/ui/node_modules/systemjs-builder/node_modules/traceur/bin/traceur.js:1874:20)
    at /Users/martinmicunda/projects/employee-scheduling/ui/node_modules/systemjs-builder/node_modules/traceur/bin/traceur.js:1868:9
    at flush (/Users/martinmicunda/projects/employee-scheduling/ui/node_modules/systemjs-builder/node_modules/traceur/bin/traceur.js:1672:7)
    at process._tickCallback (node.js:419:13)
@guybedford
Copy link
Member

Try changing this line - builder.loader.baseURL = path.resolve('./src/'); to builder.loader.baseURL = 'file:' + path.resolve('./src/');

@martinmicunda
Copy link
Author

@guybedford I tried however it didn't work :(

@guybedford
Copy link
Member

@martinmicunda did it give the same issue?

@guybedford
Copy link
Member

@martinmicunda does your config file include a path configuration for github: like:

System.paths['github:*'] = 'jspm_packages/github/*.js';

@martinmicunda
Copy link
Author

@guybedford
Copy link
Member

It could be worth checking builder.loader.paths in the code there to be sure it is being set properly?

@guybedford
Copy link
Member

@martinmicunda I've worked out the issue here - #43. Aiming to get a fix in very soon. Thanks so much for helping to catch this.

@martinmicunda
Copy link
Author

no problem glad to help ;)

@guybedford
Copy link
Member

@martinmicunda this has been fixed with 93566a7, I'll be posting out a release tomorrow.

@martinmicunda
Copy link
Author

That's perfect I will test it! Thanks

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

No branches or pull requests

2 participants