Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 00:57
    guybedford commented #2016
  • 00:56
    guybedford closed #2010
  • 00:56

    guybedford on master

    Replace querySelectorAll.forEac… (compare)

  • 00:56
    guybedford closed #2033
  • 00:56
    guybedford commented #2033
  • Sep 20 22:04
    HeavenVolkoff opened #2033
  • Sep 19 15:43
    viT-1 commented #2016
  • Sep 19 04:05
    shrinktofit closed #2031
  • Sep 19 04:05
    shrinktofit commented #2031
  • Sep 19 03:29
    shrinktofit commented #2031
  • Sep 19 03:28
    shrinktofit opened #2032
  • Sep 19 03:27
    guybedford commented #2031
  • Sep 19 03:20
    shrinktofit edited #2031
  • Sep 19 03:19
    shrinktofit opened #2031
  • Sep 18 17:16
    khangiskhan commented #2026
  • Sep 18 17:16
    khangiskhan opened #2030
  • Sep 18 15:41
    joeldenning commented #2026
  • Sep 18 15:41
    joeldenning commented #2026
  • Sep 18 11:44
    khangiskhan commented #2026
  • Sep 18 11:43
    khangiskhan commented #2026
carlosagsmendes
@carlosagsmendes
but I get the following message
uild error
{ [Error: Error loading "main" at file:/Users/carlosmendes/Repos/bundling/src/main.js
Error loading "npm:babel-core@5.1.2" at file:/src/lib/npm/babel-core@5.1.2.js
any ideas?
Guy Bedford
@guybedford
Have you installed Babel?
carlosagsmendes
@carlosagsmendes
yes
when I type babel in the command line it is there
Guy Bedford
@guybedford
but locally into the application?
npm install babel or jspm install babel if using jspm
carlosagsmendes
@carlosagsmendes
no... I missed that
I'm still getting the same error { [Error: Error loading "main" at file:/Users/carlosmendes/Repos/bundling/src/main.js Error loading "babel" at file:/Users/carlosmendes/Repos/bundling/src/babel.js ENOENT, open '/Users/carlosmendes/Repos/bundling/src/babel.js'] errno: -2, code: 'ENOENT', path: '/Users/carlosmendes/Repos/bundling/src/babel.js' }
The only "special thing" I'm doing is loading the config file

```var path = require("path");
var Builder = require('systemjs-builder');

var builder = new Builder({
baseURL: './src',
// any map config
// map: {
// jquery: 'jquery-1.2.3/jquery'
// },

// opt in to Babel for transpiling over Traceur
transpiler: 'babel'

// etc. any SystemJS config
});
builder.loadConfig('config.js');

builder.build('main', 'main-outfile.js')
.then(function() {
console.log('Build complete');
})
.catch(function(err) {
console.log('Build error');
console.log(err);
});```

Guy Bedford
@guybedford
if its not being picked up automatically you can just set the path to Babel
paths: { babel: '../node_modules/babel/browser.js' }
or whatever
carlosagsmendes
@carlosagsmendes
I also tried that:
paths: {
'': '.js',
'babel': 'src/lib/npm/babel-core@5.1.2/browser.js',
'babel-helpers': 'src/lib/npm/babel-core@5.1.2/external-helpers.js'
},
Guy Bedford
@guybedford
and?
carlosagsmendes
@carlosagsmendes
Then I have an error about the other dependencies
Guy Bedford
@guybedford
well that's a step forward
carlosagsmendes
@carlosagsmendes
I think the problem is that my map section of the config is not imported
map: {},
Guy Bedford
@guybedford
what error are you getting?
carlosagsmendes
@carlosagsmendes
Now, "Only file URLs of the form file: allowed running in Node."
Guy Bedford
@guybedford
Try setting your baseURL to 'file:' + path.resolve('./src')
carlosagsmendes
@carlosagsmendes
it works but the dependencies are still not there: [Error: Error loading "knockout" at file:/Users/carlosmendes/Repos/bundling/src/knockout.js
Error loading "knockout" from "main" at file:/Users/carlosmendes/Repos/bundling/src/main.js
ENOENT, open '/Users/carlosmendes/Repos/bundling/src/knockout.js']
errno: -2,
code: 'ENOENT',
path: '/Users/carlosmendes/Repos/bundling/src/knockout.js' }
when I log my builder object to the console, the map property doesn't have the maps defined in my config.js
do I need to use the file format for loading the config.hs?
Guy Bedford
@guybedford
where is your config file located? Perhaps the path in loadConfig is incorrect
loadConfig('./config.js') perhaps or loadConfig('./src/config.js')
Actually
it looks like you want to be using loadConfigSync
loadConfig returns a promise
carlosagsmendes
@carlosagsmendes
Ah! Nice catch.
now my maps are there
map:
{ babel: 'npm:babel-core@5.1.2',
'babel-runtime': 'npm:babel-runtime@5.1.2',
'core-js': 'npm:core-js@0.8.2',
knockout: 'github:knockout/knockout@3.3.0',
'github:jspm/nodelibs-process@0.1.1': [Object],
'npm:core-js@0.8.2': [Object] },
But I'm still getting an error:
Build error
{ [Error: Error loading "main" at file:/src/main.js
ENOENT, open '/src/main.js'] errno: -2, code: 'ENOENT', path: '/src/main.js' }

this is how I'm building it:

builder.build('main', 'main-outfile.js')
.then(function() {
console.log('Build complete');
})
.catch(function(err) {
console.log('Build error');
console.log(err);
});

Guy Bedford
@guybedford
sounds like you're setting the incorrect baseURL
carlosagsmendes
@carlosagsmendes
how can I debug that? now it is picking up the config file. and it is loading babel. but then it fails in getting the file
Guy Bedford
@guybedford
you're setting the baseURL yourself int he above config, so make sure you're setting it to the right value
I think you want it to be file:/Users/carlosmendes/Repos/bundling/src/, which was what my suggestion previously should have set it to, but didn't for some reason :point_up: April 13 2015 7:13 PM
carlosagsmendes
@carlosagsmendes

Here's how my config.js file looks:

System.config({
"baseURL": "/src",
"transpiler": "babel",
"babelOptions": {
"optional": [
"runtime"
]
},

carlosagsmendes
@carlosagsmendes
Guy, you are right. The problem is that loading the config file overrides the "baseURL to 'file:' + path.resolve('./src')" that you suggested.
What's the recommend approach? setting it again after loading the config?
Apparently changing it afterwards doesn't work.
Should I load the config from the filestream, change the baseURL and then create the builder?
In the documentation it is mentioned that I can change the baseURL after loading the config:

// builder.loadConfig will load config from a file
builder.loadConfig('./cfg.js')
.then(function() {
// additional config can also be set through builder.config
builder.config({ baseURL: 'file:' + process.cwd() });

return builder.build('myModule', 'outfile.js');
});