These are chat archives for canjs/canjs

22nd
Dec 2016
Gregg Roemhildt
@roemhildtg
Dec 22 2016 15:45
Hi guys, I've been looking into building an amd build of the canjs/canjs lib but I haven't been able to get it working. I added a +amd output to the canjs build script but it results in an error message: RangeError: Maximum call stack size exceeded Is there a guide on getting an amd build of canjs 3.0?
Kevin Phillips
@phillipskevin
Dec 22 2016 15:52
I don’t think there is a guide
you can copy the all block
and change the format and destination
Gregg Roemhildt
@roemhildtg
Dec 22 2016 16:10
Looks like its not that easy :worried: I changed the destination to dest: __dirname + '/dist/amd', which results in illegal operation on a directory. And using the +amd helper results in that call stack exceeded error. Have you gotten an amd build to work with canjs 3?
Kevin Phillips
@phillipskevin
Dec 22 2016 16:11
yeah
I didn’t test it very well, but this ran and the output appeared to be AMD
                "all": {
                        modules: ["can/all"],
                        format: "amd",
                        dest: globalJS.dest(__dirname+"/dist/amd/can.all.js"),
                        useNormalizedDependencies: true,
                        normalize: function(depName, depLoad, curName, curLoad, loader){
                                return baseNormalize.call(this, depName, depLoad, curName, curLoad, loader, true);
                        },
                        // ignore jquery
                        ignore: [function(name){
                                if(name.indexOf("jquery") === 0 || name.indexOf("kefir") === 0) {
                                        return true;
                                } else {
                                        return false;
                                }
                        }],
                        exports: {"jquery": "jQuery", "can-util/namespace": "can", "kefir": "Kefir"},
                        removeDevelopmentCode: false
                }
sorry, there might be more to it than that
might be easier to get a working answer if you post the question in the forums
the reason I say there might be more to it is that you probably need to use the amd steal-tools helper instead of the globalJS one that is there
Gregg Roemhildt
@roemhildtg
Dec 22 2016 16:17
Okay, I'll look into it a bit
Kevin Phillips
@phillipskevin
Dec 22 2016 16:17
ok, if you find a solution, would be great to post to the forum
Gregg Roemhildt
@roemhildtg
Dec 22 2016 16:17
It looks like it outputs one big file with lots of defines with the above
Kevin Phillips
@phillipskevin
Dec 22 2016 16:17
yeah
that’s what made me realize the helper was wrong
is there a reason you need to use the main can package?
each of the can-* sub-packages has an AMD build
Gregg Roemhildt
@roemhildtg
Dec 22 2016 16:21
I thought that amd build would be handled by the main can package. I can switch to the can-* packages. I would just need to run the build script for each package, right?
Kevin Phillips
@phillipskevin
Dec 22 2016 16:21
if you get the can-* packages from npm, they will be built already
Gregg Roemhildt
@roemhildtg
Dec 22 2016 16:21
Oh, good. I'll give that a go
Kevin Phillips
@phillipskevin
Dec 22 2016 16:22
there’s an amd folder in the dist
the main will point to the CommonJS version, so you’ll have to map them
Gregg Roemhildt
@roemhildtg
Dec 22 2016 16:22
OKay
Maybe I'm missing something, but I just npm installed can-define and can-stache and I don't see a dist folder
Kevin Phillips
@phillipskevin
Dec 22 2016 16:27
well, crap
hmm, I see it for can-stache
never mind you’re right
Gregg Roemhildt
@roemhildtg
Dec 22 2016 16:31
Okay, I was wondering what was wrong with my npm
I think I remember reading that amd builds wouldn't be done for the individual packages... canjs/can-define#91
Kevin Phillips
@phillipskevin
Dec 22 2016 16:32
yeah, if you click through to canjs/canjs#2646
it says the main canjs package doesn’t now (that issue is still open, so it might still be added)
I thought all of the sub projects had amd builds, but I guess that’s not the case
and actually, it doesn’t look like any of them are published
Gregg Roemhildt
@roemhildtg
Dec 22 2016 16:35
Right. I also tried running the can-define build script but it doesn't actually output amd
Kevin Phillips
@phillipskevin
Dec 22 2016 16:35
yeah, I noticed that too
Gregg Roemhildt
@roemhildtg
Dec 22 2016 16:37
Well it should be possible from the canjs package, I just need to figure out the helper issue
Kevin Phillips
@phillipskevin
Dec 22 2016 16:37
yeah, sorry to lead you down the wrong path
Gregg Roemhildt
@roemhildtg
Dec 22 2016 16:37
No worries :smile:
Justin Meyer
@justinbmeyer
Dec 22 2016 17:06
Proposal to make working with nested document structures a bit easier: canjs/can-connect#231
Gira Minus
@gKreator
Dec 22 2016 21:12
I like it