These are chat archives for systemjs/systemjs

10th
May 2016
Josiah Haswell
@josiahhaswell
May 10 2016 03:44
Hi folks. I'm trying to include Opentip, and it exports a global variable
I've found: jspm/jspm-cli#689
And numerous other things, but I can't quite get it to work

    "meta" : {
      "github:enyo/opentip@^2.4.6/lib/opentip" : {
        "deps" : "jquery",
        "format" : "global"
      }
    },
And several variations thereon haven't worked
Am I going down the wrong path?
niabot
@niabot
May 10 2016 11:47

Something must be wrong. The Promise returned by SystemJS does neither execute then nor catch. If i remove the bundles section it will at least catch an error. But as it currently is, i get nothing.

System.config({
    baseURL: 'lib',
    paths: {
        '*': '*.js'
    },
    map: {
        'jquery':   'jquery-2.1.4'
    },
    bundles: {
        'asysform': [
            'asysform/base',
            'asysform/collection',
            'asysform/concurrent',
            'asysform/event',
            'asysform/exception',
            'asysform/ext',
            'asysform/geom',
            'asysform/i18n',
            'asysform/io',
            'asysform/prop',
            'asysform/property',
//            'asysform/ui',
            'asysform/ui/app',
            'asysform/ui/browser',
            'asysform/ui/cell',
            'asysform/ui/container',
            'asysform/ui/control',
            'asysform/ui/core',
            'asysform/ui/enums',
            'asysform/ui/input',
            'asysform/ui/layout',
            'asysform/ui/list',
            'asysform/ui/notification',
            'asysform/ui/paint',
            'asysform/ui/selection',
            'asysform/ui/svg',
            'asysform/ui/util',
            'asysform/validation'
        ]
    },
    meta: {
        'asysform': {
            scriptLoad: true,
            format: 'register'
        },
        'asysshop': {
            scriptLoad: true,
            format: 'register'
        }
    }
});

var config = {
    apibase: 'http://silex.asys'
};

console.log('before');
System.import('asysshop')
.then(function (shop) {
    console.log('start');
    shop.start(config);
})
.catch(function (err) {
    console.log('error');
    console.log(err);
});
console.log('after');

Output:

before
after
niabot
@niabot
May 10 2016 11:53
It somehow exits silently, doing nothing :worried:
niabot
@niabot
May 10 2016 12:53
@guybedford You told me yesterday that the bundles option can be used to tell SystemJS that multiple modules should be loaded from the same file. Today i tried it out, but SystemJS behaves strangely. The returned Promise from System.import('asysshop') does not call any callback for then() or catch(). It exits silently and does only load the first module asysshop, ignoring all other dependencies/imports.
Do you have any idea what might be causing this? I tried to debug SystemJS, but well, without knowing it's internals it is quite hard to follow what is going on.
niabot
@niabot
May 10 2016 13:19
It looks like all modules get loaded, but in the end the returned promise wont execute it's callbacks.
The register callbacks also don't get executed. It only loads the files, without executing them.
Trey Long
@xealot
May 10 2016 15:31
For building using SystemJS builder, I have node_modules at a lower level than my other application code. On the server I map node_modules from the root of the project so it can be served outside of the root. However, I can't figure out a way to setup the builder to look outside of the baseURL for node_modules.
Any ideas?
Peter Müller
@Munter
May 10 2016 15:32
I recommend you use jspm to install these modules inside the web root instead
Trey Long
@xealot
May 10 2016 15:33
I've been avoid that step because we also have server components that use the same dependencies and I didn't love the idea of installing two separate trees of modules.
I suppose that's foolish idealism getting in the way though :)
So outside of using JSPM, is it POSSIBLE to use SystemJS and SystemBuilder to this?
Peter Müller
@Munter
May 10 2016 15:36
Probably. But I would not recommend it. You will run into a whole bunch of special cases that are fixed by overrides in jspm.
niabot
@niabot
May 10 2016 17:32
I'm still running in circles... So now i tried to use systemjs-builder (to be exact I'm using grunt-systemjs-builder) to build a single application file. But it only contains the modules of my main application file 'asysshop' but not the needed library 'asysform'. How do i tell it to build single file which includes all external dependencies?
Peter Müller
@Munter
May 10 2016 17:35
That extra abstraction will just hurt you in the end. Use the builder directly
Trey Long
@xealot
May 10 2016 17:36
@Munter you think jspm@0.17 is stable enough to use? or is it "extremely" beta?
niabot
@niabot
May 10 2016 17:38
@Munter I saw that. But how would i do that with grunt-systemjs-builder? I don't know how to define a bundle within the config of it.
Peter Müller
@Munter
May 10 2016 17:38
@xealot I honestly don't know. I was terminated from the job where we were implementing jspm/systemjs. 0.17 came a long when people were being let go, so noone wanted to take the risk of a quick untested implementation and leave a possible mess for the ones taking over
@niabot as I said, drop the middle men. The grunt wrapper will only end up hurting you
Trey Long
@xealot
May 10 2016 17:38
well, that's unusually kind of you.
Peter Müller
@Munter
May 10 2016 17:39
Its what any good developer would do. We had a lot of those, but only a handful stayed and had to keep things running
The whole operation was moved across the atlantic
Trey Long
@xealot
May 10 2016 17:40
oh man, that's crap
I hate that kinda thing
wait...
Peter Müller
@Munter
May 10 2016 17:41
Yeah. Strategic crap I had no influence on
Trey Long
@xealot
May 10 2016 17:41
Are you in DE?
Peter Müller
@Munter
May 10 2016 17:41
DK
Trey Long
@xealot
May 10 2016 17:41
so across the atlantic means, US?
Peter Müller
@Munter
May 10 2016 17:41
Yup
Trey Long
@xealot
May 10 2016 17:42
dang, still sucks
To me here it typically means to India/China, which is always something disappointing.
niabot
@niabot
May 10 2016 17:42
@Munter I tried to use it because i wanted a quick test. Currently i was using systemjs directly, but it simply doesn't do anything if i try to use the bundles option. It really does nothing. It loads the files, but does not register the libraries and just exits right in the middle of the process, returning a promise that doesn't even call any then() or catch() callbacks....
Peter Müller
@Munter
May 10 2016 17:43
Now that sounds like a bug. Reduce it to a minimum test case and file an issue on Github. Guy usually verifies really quickly and implements fixes within a very short while
niabot
@niabot
May 10 2016 17:44
For example: System.import('asysshop').then(...not executed...).catch(...not executed...);
Peter Müller
@Munter
May 10 2016 17:44
@xealot I actually partially agree with the cut. We had become to bloated. But this was also due to a strategy by the bigger corp which we had little influence on.
@xealot The move was most likely bad though. They lost all of their accumulated experience. Noone senior stayed
Trey Long
@xealot
May 10 2016 17:46
It's always a deep cut when that kinda thing happens, someone must have been dead set on consolidating/moving things.
Is there any quick way to have jspm install the things I already have listed in package.json?
Peter Müller
@Munter
May 10 2016 17:47
Yeah, this came from way above. Our product was just a tiny spec that didn't matter in the big picture
Reduce the amount of locations and consolidate on core products. We were an acquired startup and were allowed to stay in Copenhagen back when it happened. So that's one location, with only room for 100 people
Someone up high just took a red pen and striked it out
Trey Long
@xealot
May 10 2016 17:50
We just need to remove access to red pens...
Peter Müller
@Munter
May 10 2016 17:53
I stopped caring. I had seen the end of my possibilities to improve myself there. Bigcorp was not going where I wanted to. All virtualization and apps instead of web technology.
And then in january I got sick, so all of that kind of became not important.
Trey Long
@xealot
May 10 2016 17:57
rough year sounds like
Peter Müller
@Munter
May 10 2016 18:06
Indeed. Bought, refurbished and moved into a new house. Had my first child. Lost my job. Got sick
It sounds worse than it is though. The system in Denmark works quite well
Tell your non-Bernie voters ;)
Trey Long
@xealot
May 10 2016 18:06
It always seems to go like that... everything at once, never when convenient.
lol
As if I could tell them anything
people's minds are made already
Peter Müller
@Munter
May 10 2016 18:10
It has been refreshing hearing him iterate through some of the core arguments of the social democratic movement we had in the 60's and 70's. Now it seems that people here have forgotten that all the low wage worker fought tooth and nail to get these benefits. People just take them for granted now
But it really makes all the difference. These life events I had in the last year. Had I lived in the US it might easily have meant financial ruin.
Trey Long
@xealot
May 10 2016 18:16
IMO The US is coming off of a few generation long high. As future generations feel the inevitable squeeze of reality, policies will change. Sadly, many individuals hold their opinions so strongly that they have to die and be replaced before updating their view. I think it's a common problem, it will either work itself out or maybe I'll see what DK looks like.
Peter Müller
@Munter
May 10 2016 18:17
Most of the northern european countries have variations of similar systems. It's not like Denmark is unique
Trey Long
@xealot
May 10 2016 18:20
So, back to JSPM...
I am trying it per your recommendation, however it seems to put jspm_packages in the root of the dir also, which would be outside of the public webroot.
niabot
@niabot
May 10 2016 18:21
@Munter I reduced the problem to a much simplified test case. But it are still multiple files. What would be the best way to provide the example?
Peter Müller
@Munter
May 10 2016 18:22
The placement of it is configurable in your package.json > jspm section
@niabot a gist with all the files or a github repository that can easily be checked out and run the needed commands in
@xealot When you run jspm init you get asked where the jspm_packages directory should go
Trey Long
@xealot
May 10 2016 18:24
I'm like 99% sure I didn't say root.
what's the config option?
    "directories": {
      "lib": "src/public"
    },
is that it?
Peter Müller
@Munter
May 10 2016 18:29
jspm.directories.baseURL if I recall correctly
Trey Long
@xealot
May 10 2016 18:32
ok, reading a little more now
baseURL is really a "path"
somewhat misnamed
Peter Müller
@Munter
May 10 2016 18:33
I think it's seen from a web servers perspective pretty much
Wow... that chat thingy is more intelligent as needed :worried:
Peter Müller
@Munter
May 10 2016 19:02
@niabot Looks like the information to debug is there
Preston Lamb
@pjlamb12
May 10 2016 19:25
Hello everyone, I'm having an issue with SystemJS in my Angular 2 app. If anyone could help, I'd be very appreciative. All the info is in this SO question: http://stackoverflow.com/questions/37146891/angular-2-and-sails-js
niabot
@niabot
May 10 2016 19:30
@pjlamb12 Did you check what files/urls SystemJS tries to load within a debugger?
Preston Lamb
@pjlamb12
May 10 2016 19:31
@niabot Yes. Well, I tried, but it doesn’t attempt to pull anything in. There are no errors, even if I put in an intentionally incorrect path to the files.
niabot
@niabot
May 10 2016 19:33
@pjlamb12 How does the entry point into your app look like? SystemJS will only load files/modules which are depended on.
Preston Lamb
@pjlamb12
May 10 2016 19:35
@niabot Do you mean the main.ts file?
niabot
@niabot
May 10 2016 19:37
No and Yes. Something (like <script>System.import('app).then(...</script>) would have to import the app module to get things started. The main.js of app should then have dependencies to the angular stuff and so on.
The config simply tells SystemJS where to find stuff and how to load it. Actual loading has to be triggered by System.xyz calls or imports.
Preston Lamb
@pjlamb12
May 10 2016 19:39
@niabot okay, yeah, the HTML file imports the app, just like that, and then inside the main.ts file (main.js) imports different modules. Like @angular/router-deprecated for example.
niabot
@niabot
May 10 2016 19:41
So you have System.import('app') inside you html file. This should trigger the loading of 'js/main.js', if I'm not mistaken.
Maybe you want to open a gist, so that i can get a better understanding of what happens.
Preston Lamb
@pjlamb12
May 10 2016 19:43
Yeah, main.js is being pulled in. I can see it in the Network tab. Okay, give me a second. I’ll post the link.
niabot
@niabot
May 10 2016 19:52
I see a main.ts file, so i can assume that there is a corresponding main.js file right?
Preston Lamb
@pjlamb12
May 10 2016 19:53
It is transpiled by our gulp process for us into a main.js file.
I added the main.js file to the gist. Just as a reference.
And you can see the main.js file in the browser network tab.
niabot
@niabot
May 10 2016 20:06
I wonder if map: { '@angular': 'js/dependencies/@angular' } would apply to imports that are not exactly named @angular. With paths: { '@angular/*': 'js/dependencies/@angular/*' } you can use wildcards
Preston Lamb
@pjlamb12
May 10 2016 20:08
I think I might have fixed the issue. I’m not sure why it matters, but tsconfig.json had an outFile designated. I made sure it was in the right place in the app, but when I removed that line altogether it is now pulling down all the angular files. The app isn’t showing up, but one problem at a time. Thanks for your help @niabot!
niabot
@niabot
May 10 2016 20:10
If you have an an outFile, then ts will generate one file containing all the modules of that typescript project.
Thats explains why you main.js is that long ;-)
Trey Long
@xealot
May 10 2016 20:52
jspm@0.17, I can't get it to install jspm_packages anywhere else besides the root where I initialize it via jspm init. Our webroot is dist/public which is created from src/public. I usually don't get stuck on step one, any advice?
Guy Bedford
@guybedford
May 10 2016 21:09
@xealot try jspm init -p then its the package.json directories.packages prompt
use standard init to see the option (quick skips it)
Trey Long
@xealot
May 10 2016 21:13
lemme give it a go
you always zoom in here when I'm about to give up @guybedford :)
Trey Long
@xealot
May 10 2016 21:21
Is there a recommendation for how to structure a project with JSPM? We traditionally have a "src" folder and then compile into "dist". What is the most appropriate place to locate JSPM packages? In src and then copy to dist? Or directly in dist? "dist" isn't committed so I feel like we would be losing some config if it was just in dist... so that's probably not right. But I don't really wanna commit the jspm packages files either.
but then again, in src it doesn't feel completely right since it's almost entirely typescript...
Guy Bedford
@guybedford
May 10 2016 21:25
@xealot jspm_packages should be separate to the src folder. If you want to have src and jspm_packages outside of the public directory that can work too though
Trey Long
@xealot
May 10 2016 21:26
The reason I thought it should be within the public directory is because the instructions on the jspm guide show the browser loading the config files (and then subsequently, I assume, dependencies).
src is def not really "within" public, it's just mirrored there so TS compiling puts it there automatically in a dist folder.
Guy Bedford
@guybedford
May 10 2016 21:27
yeah we encourage the simpler setup of the baseURL matching between client and server
so then jspm_packages and src are both within the baseURL
but you can set custom paths to them both to avoid that
Trey Long
@xealot
May 10 2016 21:28
they still need to be somewhere in the final dist/public though
Guy Bedford
@guybedford
May 10 2016 21:29
baseURL is either the public root, or a subpath of it
so yes, when within the baseURL
but otherwise you can just setup custom paths
jspm_packages can be removed from being served publicly if you bundle everything
Trey Long
@xealot
May 10 2016 21:30
this is the eventual goal I have :)
Guy Bedford
@guybedford
May 10 2016 21:30
yeah the init stuff is still an area that's been polished
*being
I'm trying out some simplifications for the next release
Trey Long
@xealot
May 10 2016 21:31
very interested.
I have really enjoyed using systemjs
Guy Bedford
@guybedford
May 10 2016 21:32
spent the whole day just thinking through these init config problems actually
Trey Long
@xealot
May 10 2016 21:32
It's been recommended to me that I should use jspm to get bundling working though
Guy Bedford
@guybedford
May 10 2016 21:32
well its best just to work with the default cases if you can to start
Trey Long
@xealot
May 10 2016 21:33
I don't envy you coming up with a solution that is perfect when dealing with the multitude of paths and rules around said paths.
the default cases, in this instance, jspm?
Guy Bedford
@guybedford
May 10 2016 21:33
yeah it's the main user interface, and one of the most complex parts to make it seem understandable
more complex than module loading just managing the configuration file itself
yes just the default init values to do some bundling tests
then you can try moving folders one-by-one perhaps via jspm init -p
and see how things change in the package.json and jspm.browser.js files
Trey Long
@xealot
May 10 2016 21:35
indeed, I'm just trying to plop in them a place where the browser can reach them at the moment
I thought using npm and system worked great for us, it felt simple. Once you got the path magic right it worked in a fairly durable manner.
I was kinda -1 on jspm because of the node_modules/jspm_packages duplication. I know the reason why its necessary but it didn't seem like it was required.
it wasn't required in that, I didn't have to use jspm to use system/systembuilder
Guy Bedford
@guybedford
May 10 2016 21:37
you can always just use SystemJS builder directly without jspm
Trey Long
@xealot
May 10 2016 21:37
that's what I was trying to do earlier this morning
Guy Bedford
@guybedford
May 10 2016 21:37
if your loading was working in the browser with SystemJS
then building it with SystemJS builder is just following the standard steps
Trey Long
@xealot
May 10 2016 21:38
Hrm, I am still going to pursue jspm more but lemme see what that problem was I kept running into
oh right, probably a similar thing I'm dealing with now
we have a basic structure like this:
node_modules
dist/public/<compiled junk>
src/public/<typescript mostly>
so src/public goes into dist/public
but I create a node_modules mapping in our server so node_modules looks like it lives in the webroot.
I can make that work using builder, but then the module names are all rooted from the repo root which won't work
Guy Bedford
@guybedford
May 10 2016 21:45
Create a path config for node_modules when running the builder - paths: {'node_modules/':'./node_modules/'} then the names will be the path alias in the build
Trey Long
@xealot
May 10 2016 21:45
hrm, paths?
I have that in map
    builder.config({
        map: {
            "node_modules": "./node_modules",
...
Guy Bedford
@guybedford
May 10 2016 21:45
right so move it to map
with a trailing / in the target
well on both sides
paths define the naming scheme in systemjs builder
Trey Long
@xealot
May 10 2016 21:47
ok ,that seems to work mostly equivalently.
in my outfile I get things like this:
System.register("dist/public/app/boot.js"
which isn't really what that module is going to be referred to as
because I will call System.import("app/boot") to kickoff the app
and similarly, the node_modules dependencies, while found, are called things like node_modules/angular2/src/platform which nothing refers to them as.
Guy Bedford
@guybedford
May 10 2016 21:49
then do the same for app - paths: { 'app/': 'dist/public/app/' }
I guess you want just angular2/src/platform?
Trey Long
@xealot
May 10 2016 21:50
yeah, that's what it calls itself
Guy Bedford
@guybedford
May 10 2016 21:50
then set the baseURL to node_modules rather, and paths: { 'app/': './dist/public/app/' } (./ necessary there to not use baseURL)
Trey Long
@xealot
May 10 2016 21:50
node_modules is more of an implementation detail :)
That will break my own application's dependencies, right?
Guy Bedford
@guybedford
May 10 2016 21:53
not sure what you mean?
Trey Long
@xealot
May 10 2016 21:57
I'm not either I guess...
alright, I tweaked this as you suggested.
I am still getting things like this:
System.registerDynamic("node_modules/angular2/platform/browser.js"
Guy Bedford
@guybedford
May 10 2016 21:59
Are you sure you set the builder baseURL to node_modules?
Trey Long
@xealot
May 10 2016 21:59
does it need trailing/leading anything?
Guy Bedford
@guybedford
May 10 2016 21:59
nope
Trey Long
@xealot
May 10 2016 21:59
var builder = new Builder('node_modules', 'dist/public/system.config.js');
Guy Bedford
@guybedford
May 10 2016 21:59
check builder.loader.baseURL is definitely correct?
Trey Long
@xealot
May 10 2016 22:00
I get a file:/// ref to node_modules
Guy Bedford
@guybedford
May 10 2016 22:00
good, and you don't have a path set for node_modules
?
Trey Long
@xealot
May 10 2016 22:01
I was just about to ask if I was supposed to use the baseURL in place of the paths thing
I'll remove that
Guy Bedford
@guybedford
May 10 2016 22:01
yeah that will do it
paths always define the naming system first
Trey Long
@xealot
May 10 2016 22:02
hrm, now it seems to be doubling up... no such file.... node_modules/node_modules/angular2/core.js
my fault probably, I'm trying to base this on the browser config
I use map heavily, it sounds like I should be favoring paths though
I do a lot of stuff like this:
Guy Bedford
@guybedford
May 10 2016 22:03
any map targets to node_modules/x should now be just x because of the baseURL
Trey Long
@xealot
May 10 2016 22:04
hrm.
Guy Bedford
@guybedford
May 10 2016 22:04
you can have map targets to ./node_modules which will also work
plain names are baseURL-relative
Trey Long
@xealot
May 10 2016 22:04
    map: {
        'angular2': 'node_modules/angular2',
        'rxjs': 'node_modules/rxjs',
        'lodash': 'node_modules/lodash/lodash.js',
        'spark-md5': 'node_modules/spark-md5/spark-md5.js',
        'ng2-bootstrap': 'node_modules/ng2-bootstrap',
        'ng2-bs3-modal': 'node_modules/ng2-bs3-modal',
        'moment': 'node_modules/moment',
    },
Guy Bedford
@guybedford
May 10 2016 22:04
yup
Trey Long
@xealot
May 10 2016 22:04
ok
Guy Bedford
@guybedford
May 10 2016 22:04
either add ./ in front of node_modules, or just remove it
Trey Long
@xealot
May 10 2016 22:05
since they're all mostly the same I can ditch all but the ones that map directly to a JS file yeah?
Guy Bedford
@guybedford
May 10 2016 22:05
yeah
Trey Long
@xealot
May 10 2016 22:05
I am learning so much today!
looks like that breaks my defaultExtension option
You suggested this to me earlier:
        packages: {
            'node_modules': {
                defaultExtension: 'js'
            },
Guy Bedford
@guybedford
May 10 2016 22:06
yes packages need to transpose as well for the baseURL
so you can add a ./node_modules or actually just a '': {} package will work too
Trey Long
@xealot
May 10 2016 22:07
yeah, I guessed ''
trying
odd
it's looking for things like this now:
node_modules/lodash/lodash.js/lodash.js
    builder.config({
        map: {
            'lodash': 'lodash/lodash.js',
            'spark-md5': 'spark-md5/spark-md5.js'
        },
        paths: {
            "app/": "./dist/public/app/"
        },
        packages: {
            '': {
                defaultExtension: 'js'
            },
Guy Bedford
@guybedford
May 10 2016 22:10
have you got an import 'lodash/lodash.js' anywhere?
even require('lodash/lodash.js') will do that
Trey Long
@xealot
May 10 2016 22:11
looking
I highly doubt in my own code
Guy Bedford
@guybedford
May 10 2016 22:11
just one file of one dependency has to do it for it to count
Trey Long
@xealot
May 10 2016 22:11
yeah
Guy Bedford
@guybedford
May 10 2016 22:11
that's why its better to configure through package main config
then both lodash/lodash.js and lodash work
note all this work is fighting the node module system
jspm does exactly do that for you
but you can get there if you want to persevere
Trey Long
@xealot
May 10 2016 22:13
it always seems uphill in JS sometimes...
grep -R "lodash/lodash.js" node_modules revealed nothing
Guy Bedford
@guybedford
May 10 2016 22:13
and the build was working before?
without doing that?
Trey Long
@xealot
May 10 2016 22:13
non bundled build works but my system config has changed a bit in the last few minutes
though, WRT lodash you pretty much see what it does
Guy Bedford
@guybedford
May 10 2016 22:14
what I mean was when you were previously bundling, before we changed lodash to a possibly circular map, did you get a duplicating like that?
Trey Long
@xealot
May 10 2016 22:15
the bundle would fail before I saw that, this is the first time I'm seeing this error. I can rollback a step and see if that appears anywhere in the final output
This is an error from the systemjs builder directly.
Guy Bedford
@guybedford
May 10 2016 22:16
but before your build would complete though
?
Trey Long
@xealot
May 10 2016 22:17
yeah, it completed several times before fixing the weird root path that modules were being registered as.
so, the builder AWESOMELY tells me the chain of deps here that it's using, looking at the final file that requires lodash it does look like a plain require("lodash")
{ [Error: Error on fetch for lodash/lodash.js at file:///.../node_modules/lodash/lodash.js/lodash.js
    Loading @ihm/assets-selector/asset-selector.component.js
    Loading @ihm/assets-selector/index.js
    Loading app/app.js
    Loading app/boot.js
cat node_modules/@ihm/assets-selector/asset-selector.component.js | grep lodash
var _ = require("lodash");
Guy Bedford
@guybedford
May 10 2016 22:19
Ok thanks, that's a bug - I've created systemjs/builder#585
Trey Long
@xealot
May 10 2016 22:19
oops, sorry :)
Guy Bedford
@guybedford
May 10 2016 22:20
Instead of those maps switch to package config though -
packages: {
  'lodash': {
    main: 'lodash.js'
  },
  'spark-md5': {
    main: 'spark-md5.js'
  }
}
then you'll just be left with issues around Node core module loading and directory requires!
which are both tough problems though....
Trey Long
@xealot
May 10 2016 22:21
lol!
Guy Bedford
@guybedford
May 10 2016 22:21
this is very much an upstream direction here though
Trey Long
@xealot
May 10 2016 22:21
I'm also starting to feel like map is toxic :)
Guy Bedford
@guybedford
May 10 2016 22:21
most people would have given up by now
Trey Long
@xealot
May 10 2016 22:22
My mother always said I didn't know how to listen.
Guy Bedford
@guybedford
May 10 2016 22:22
typically, you want to load browser builds with systemjs
not Node CommonJS ecosystem stuff directly
that's what jspm gives you
Trey Long
@xealot
May 10 2016 22:22
Maybe I'm weird, I just wanted to see it done manually once so I can better understand what is going on
Guy Bedford
@guybedford
May 10 2016 22:23
anyway, the directory requires thing is that anywhere there is require('./lib') you need to manually tell SystemJs to find require('./lib/index.js') via internal package maps
Trey Long
@xealot
May 10 2016 22:23
I fully anticipate transitioning to JSPM, while things were simple though it seemed easier to just slap together a system config and go.
Guy Bedford
@guybedford
May 10 2016 22:23
then the final thing is your node core modules
which need Browserify shims
which is complex to do with SystemJS
you need to map eg fs into the browserify shim that can provide the utility module for fs
Trey Long
@xealot
May 10 2016 22:23
well, this is browser code... so hopefully that won't come into play
I mean, nothing should ask for that
maybe
Guy Bedford
@guybedford
May 10 2016 22:24
otherwise you can map them into @empty to try clearing them all
there will be at least one require('path') somewhere in your dependencies I expect
you can even grep for it
eg map: { path: '@empty' }
then see what breaks
anyway good luck with it
Trey Long
@xealot
May 10 2016 22:24
well, that was a successful run
erichooshmand
@erichooshmand
May 10 2016 22:25
So has anyone successfully bundled JUST the @angular RCs with systemjs-builder?
Trey Long
@xealot
May 10 2016 22:25
everything seems rooted properly.
I'm too scared to move from beta.15 @erichooshmand, the angular channel is awash with issues
So... The only issue with this outfile is things are being defined as *.js but things are required not using an extension.
erichooshmand
@erichooshmand
May 10 2016 22:26
@xealot I know, I'm one of those wailing loudly and trying to bundle to root @angular paths with the code systemjs-builder emits as the base, then writing my own bundler on top of that
Trey Long
@xealot
May 10 2016 22:26
System.register("app/boot.js", ["angular2/core"
or maybe it isn't an issue, if it's resolved internally somehow
Hey @guybedford if you're out for today thanks a ton for the help to understand this stuff. My fallback of trying random things is slow going. I'm going to attempt to use jspm to solve some of these issues.
Guy Bedford
@guybedford
May 10 2016 22:36
@xealot sure no problem. If you set System.config({ packages: { 'angular2': { defaultExtension: 'js' } } }) before loading the bundle file, then those extensions should all work out correctly. Then yes, jspm is the less manual approach to this stuff. Either take it as a learning experience and go through each step logically, or try and follow a boilerplate that is known to work perhaps.
Trey Long
@xealot
May 10 2016 22:42
HECK YEAH, WORKS!
it's not even that bad :)
Trey Long
@xealot
May 10 2016 23:05
@guybedford is the 2nd option to new Builder supposed to be a file that contains System.config({...}) or something else? I don't seem to get my packages config when using it to load an existing file.