These are chat archives for canjs/canjs

26th
Feb 2017
DaveO
@DaveO-Home
Feb 26 2017 18:43

Issues with upgrade from Canjs 3.4.0 to Canjs 3.4.1:

  1. can/control - I have node_modules/can installed ("can": "^3.4.0",).
    steal("can/control"..., function(Control...) {

     Control.extend(...  <=====failed with "not a function" error.

    }

    Added "can-control": "*", to package and changed steal to;
    steal("can-control"..., function(Control...) {

     Control.extend <==== worked

    }

    Question, does the proper configuration for canjs require the individual modules in package.json? I find it convenient to just configure "can".

  2. Steal-tools: application is using the Steal-CSS extension,
    steal.import("node_modules/font-awesome/css/font-awesome.min.css"); Note: the app will build properly.
    Building with steal-tools javascript;

    !/usr/bin/env node

    var stealTools = require("steal-tools");
    //
    var promise = stealTools.build({ .....

Stack trace repeated for each css file import....

Potentially unhandled rejection [58] Error: Error loading "components/font-awesome/css/font-awesome.min.css!steal-css@1.2.1#css" at file:/home/daveo/NetBeans/Resume/web/components/font-awesome/css/font-awesome.min.css
Unable to load CSS in an environment without a document.
at getDocument (file:/home/daveo/NetBeans/Resume/web/node_modules/steal-css/css.js:36:8)
at load.metadata.execute (file:/home/daveo/NetBeans/Resume/web/node_modules/steal-css/css.js:224:7)
at linkDynamicModule (/home/daveo/NetBeans/Resume/node_modules/steal-systemjs/dist/system.src.js:743:32)
at link (/home/daveo/NetBeans/Resume/node_modules/steal-systemjs/dist/system.src.js:602:11)
at Object.execute (/home/daveo/NetBeans/Resume/node_modules/steal-systemjs/dist/system.src.js:934:11)
at doDynamicExecute (/home/daveo/NetBeans/Resume/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1969:25)
at link (/home/daveo/NetBeans/Resume/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:2017:24)
at doLink (/home/daveo/NetBeans/Resume/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1791:7)
at updateLinkSetOnLoad (/home/daveo/NetBeans/Resume/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1839:18)
at /home/daveo/NetBeans/Resume/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1645:11

Gira Minus
@gKreator
Feb 26 2017 18:49
#1 its best to use them individually
DaveO
@DaveO-Home
Feb 26 2017 18:51
Ok, but all of the other "can/" modules are working properly.
Gira Minus
@gKreator
Feb 26 2017 18:52
Yeah it should all work
Its just kinda preferred to only load what is needed
Did u try to delete ur node_modules folder and reinstall?
DaveO
@DaveO-Home
Feb 26 2017 18:53
steal-tools selects only what is used for production, I think?
Actually that is what I eventually did to get things working again, the the Control.extend issue remain.
Gira Minus
@gKreator
Feb 26 2017 18:55
So #2 is working?
DaveO
@DaveO-Home
Feb 26 2017 18:55
Not without my change to the individual module can-control.
Gira Minus
@gKreator
Feb 26 2017 18:56
One sec let me get to my pc

did you try

steal("can/control/"

?
DaveO
@DaveO-Home
Feb 26 2017 19:00
Will try...
Got this: TypeError: Error loading "resume@0.0.3#appl/js/index" at http://localhost:8080/resume/appl/js/index.js
Control.extend is not a function
Stack trace:
anonymous/<@http://localhost:8080/resume/appl/js/utils/basecontrol.js:11:20
steal/stealInstantiateResult.execute@http://localhost:8080/resume/node_modules/steal/steal.js:5707:24
linkDynamicModule@http://localhost:8080/resume/node_modules/steal/steal.js:3659:18
linkDynamicModule@http://localhost:8080/resume/node_modules/steal/steal.js:3653:11
linkDynamicModule@http://localhost:8080/resume/node_modules/steal/steal.js:3653:11
linkDynamicModule@http://localhost:8080/resume/node_modules/steal/steal.js:3653:11
link@http://localhost:8080/resume/node_modules/steal/steal.js:3518:11
register/loader.instantiate/</<.execute@http://localhost:8080/resume/node_modules/steal/steal.js:3850:11
doDynamicExecute@http://localhost:8080/resume/node_modules/steal/steal.js:1969:20
link@http://localhost:8080/resume/node_modules/steal/steal.js:2017:24
doLink@http://localhost:8080/resume/node_modules/steal/steal.js:1791:7
Gira Minus
@gKreator
Feb 26 2017 19:04
can you do a console.log( Control );
before Control.extend
DaveO
@DaveO-Home
Feb 26 2017 19:05
Sure...
DaveO
@DaveO-Home
Feb 26 2017 19:10
Control=[object Object] basecontrol.js:10:1
Control.extend=undefined
Gira Minus
@gKreator
Feb 26 2017 19:11
weird..
how do you require in component?
or route
DaveO
@DaveO-Home
Feb 26 2017 19:12
I use require("package.json!npm");
Gira Minus
@gKreator
Feb 26 2017 19:12
then you have can.Component?
DaveO
@DaveO-Home
Feb 26 2017 19:13
Yes
Gira Minus
@gKreator
Feb 26 2017 19:13
but can.Control does not work?
DaveO
@DaveO-Home
Feb 26 2017 19:13
let me check on component
I don't explicitly use can.component
Gira Minus
@gKreator
Feb 26 2017 19:15
Umm want to send me your source code? It would help me debug this allot quicker.
DaveO
@DaveO-Home
Feb 26 2017 19:18
Here's the steal... steal("app",
"alert",
"helpers",
"underscorestring",
"can/control",
"can/map/define",
"can/construct/super",
function (App, Alert, Helpers, S, Control) {
_.mixin(S.exports());
console.log("Control="+Control);
console.log("Control.extend="+Control.extend);
return Control.extend({
init: function (element, options) {
this._super(element, options);
}
Gira Minus
@gKreator
Feb 26 2017 19:20
run
console.log(Control);
instead of
console.log("Control="+Control);
so you can actually see the object itself rather then the typeof
also try
can.Control.extend
rather then Control.extend
DaveO
@DaveO-Home
Feb 26 2017 19:22
Actually I did run console.dir but couldn't do a select all
Gira Minus
@gKreator
Feb 26 2017 19:22
blob
This was from one of my projects where I used requireJs to load canjs2
I use es6 imports now
blob
with canjs3
DaveO
@DaveO-Home
Feb 26 2017 19:24
This was working before 3.4.1... I can live with can-control but something is wrong with can/control
Gira Minus
@gKreator
Feb 26 2017 19:26
this is kinda why you should define each on manually so that you have version control
because similar things have happened to me where they push an update with a bug
blob
I would try to mimic this core as close as possible https://github.com/donejs/bitballs/tree/master/public
DaveO
@DaveO-Home
Feb 26 2017 19:31
The dependency in can/package.json for control is "can-control": "3.0.5",
Is ES6 now replacing steal?
Gira Minus
@gKreator
Feb 26 2017 19:39
not necessarily, steal just works with es6 and es6 is easier then amd
than*
DaveO
@DaveO-Home
Feb 26 2017 19:40
can I mix define() with steal() in the same .js file?
Gira Minus
@gKreator
Feb 26 2017 19:41
I've never tried that
unless you mean when importing then yes
DaveO
@DaveO-Home
Feb 26 2017 19:43
Actually, I meant import xxx from..... and steal().
Gira Minus
@gKreator
Feb 26 2017 19:44
Yeah, stealjs lets you import from multiple package formats
DaveO
@DaveO-Home
Feb 26 2017 19:44
You got an example
Gira Minus
@gKreator
Feb 26 2017 19:49
Umm its just standard importing
DaveO
@DaveO-Home
Feb 26 2017 19:49
Thanks, the stack traces from steal-tools are annoying, however....
Gira Minus
@gKreator
Feb 26 2017 19:50
Yeah they hardly help