These are chat archives for canjs/canjs

15th
Feb 2018
andre-cgn
@andre-cgn
Feb 15 2018 11:34
hey all. does anyone use canjs & webpack? i am having problems with the connect behaviours :/
Frank Lemanschik
@frank-dspeed
Feb 15 2018 12:53
what has webpack todo with your connect behaviors?
Kevin Phillips
@phillipskevin
Feb 15 2018 15:47
we have an example setup using canjs with webpack: https://github.com/canjs/webpack-example
Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 15:53
Schermafbeelding 2018-02-15 om 16.52.46.png
Any idea why I keep getting this error RangeError: Maximum call stack size exceeded. It’s something CanJS internal.
Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 16:05
I get that error every now and then, but sometimes no error and our app crashes completely...
Kevin Phillips
@phillipskevin
Feb 15 2018 16:24
kind of hard to tell from just that
can you show what MyDocRouting looks like?
Pestdoktor
@Pestdoktor
Feb 15 2018 17:36
hey there, wanted to take a look at stream properties today, but can't get it to work
can anyone tell me why this isn't logging anything
https://glitch.com/edit/#!/quill-condition?path=test/test.js:34:0
?
Kevin Phillips
@phillipskevin
Feb 15 2018 17:52
the version of can-define-stream-kefir you have is compatible with can-define@2
"can-define-stream-kefir": "^0.1.0", works with the rest of your app
try that out @Pestdoktor
Pestdoktor
@Pestdoktor
Feb 15 2018 17:54
ty, works :3
Frank Lemanschik
@frank-dspeed
Feb 15 2018 19:39
@jeroencornelissen i also got often call stack size errors
it has something to do most time with your define maps
and the propertys
how they are linked most time together with can-route
look if you get over that error something with dparm
to see if its a property on the appView or a diffrent viewModel most times its the app viewModel when you directly call a sub url of your application
Viktor Busko
@Lighttree
Feb 15 2018 19:41

@andre-cgn

hey all. does anyone use canjs & webpack? i am having problems with the connect behaviours :/

I use, but had no issues with behaviours.

Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 20:38
@phillipskevin @frank-dspeed It’s indeed a definemap we use for routing.
Here is a gist of it: https://gist.github.com/jeroencornelissen/9768f410b721461f470001c133a291e9
Frank Lemanschik
@frank-dspeed
Feb 15 2018 20:39
ok i see
there comes a lot into mind
canjs 4 expects that all is well defined
so a little example
listHash: {
Value: DefineMap,
serialize: false
},
if you link that list hash to a other component
you need to make sure that you also set Type
else the bindings don't work
i would suggest to hold the app view model as small as possible
and start debuging step by step
Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 20:43
listHash is only used internally, it’s not bound to anything else.
and still CanJS 3 in this project.
Frank Lemanschik
@frank-dspeed
Feb 15 2018 20:44
yes it was only a example
and i suggested can4 because of the syntax i saw for your define map
but you got a starting point you need to reduce your app till you find the property
that causes that
and its probally something thats set on the appViewModel
and shared with a other component
or its on the appViewModel and simply not correct set some how on request
Kevin Phillips
@phillipskevin
Feb 15 2018 20:46
is itemId the only property in your route?
Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 20:47
yes
Kevin Phillips
@phillipskevin
Feb 15 2018 21:09
sorry, don't see anything that would cause that infinite loop
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:11
i think he should remove all that propertys from the app viewmodel
and put that into a extra app-component
after that all will be magical fixed
i see that there gets a lot of stuff set on the can-route viewModel
with this methods
and can-route is what is causing the Max Call Stack size
normaly
because it has problems the handle all the parameters it got
Kevin Phillips
@phillipskevin
Feb 15 2018 21:15
if you're able to reproduce it consistently, just try hitting the pause button in the debugger while it's happening
you can probably catch it in one of those functions
and see what listener it is trying to remove
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:16
@phillipskevin that don't helps
when its happens it ends automatic
Kevin Phillips
@phillipskevin
Feb 15 2018 21:16
I don't understand what you mean
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:16
this is killing done-ssr
as soon as you hit max call stack size
Kevin Phillips
@phillipskevin
Feb 15 2018 21:16
what does this have to do with done-ssr?
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:17
it happens with it :)
Kevin Phillips
@phillipskevin
Feb 15 2018 21:17
did he say that?
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:17
lets ask it was just my magic intuition
Kevin Phillips
@phillipskevin
Feb 15 2018 21:18
so you're saying my suggestion doesn't work based on your "magic"?
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:18
@jeroencornelissen your using donejs right
i say yes because the page don't renders any more
in any situation this will stop rendering
Kevin Phillips
@phillipskevin
Feb 15 2018 21:18
why does rendering matter?
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:18
on server it will kill done-ssr in browser it will brake steal execution
because rendering is what causes the problem
the problem comes only when you request a page
not when you do donejs develop or npm start
Kevin Phillips
@phillipskevin
Feb 15 2018 21:19
this is magic intuition again?
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:19
expirence
a lot of expirence
:D
Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 21:19
No, not using donejs. Tried debugging but can’t pinpoint to what’s causing the issue.
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:20
no magic this time
@jeroencornelissen is that app public
i want to run it :)
Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 21:20
No it’s not
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:20
:(
maybe a chance that you can publish a minimal example?
that fails?
copying over your code to jsbin till it fails=?
Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 21:21
Will try that tomorrow, but the app is kind too big for jsbin.
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:22
but the failing part is at the start right?
or is a other event firering that?
Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 21:23
It only fails when you click the back button twice
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:23
and you know exactly the page in your app?
Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 21:23
Most of the time it fails silently, no error. And sometimes the max stack size.
Yes, it’s basicly only one page
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:24
ok i understand then we are talking about a diffrent problem not the general one
there is something wrong with your code some circular stuff
like your setting someprop that sets props and that again set the prop that sets prop
that loops
Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 21:25
Yes, problably something like that.
But hard to debug.
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:25
yes its really hard
Kevin Phillips
@phillipskevin
Feb 15 2018 21:26
you could try doing something like this: https://jsbin.com/wuxetus/1/edit?js,output
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:26
i simply do so with copying the component where that happens
and then rebuild it step by step
Kevin Phillips
@phillipskevin
Feb 15 2018 21:26
put the first couple of lines of that inf function inside can-event:110
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:26
till it fails
Kevin Phillips
@phillipskevin
Feb 15 2018 21:26
should be able to break in the infinite loop
and hopefully figure out what event listener is being removed
Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 21:30
thx Kevin, will try that tomorrow!
Kevin Phillips
@phillipskevin
Feb 15 2018 21:31
hope it works... it's not super consistent even with that simple example
so good luck :smile:
Jeroen Cornelissen
@jeroencornelissen
Feb 15 2018 21:32
:+1:
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:32
a other good way could be
to simply add to all functions a console.log()
i have always npm module debug every where
so i see when something gets executed more then once
i strip out debug calls then on production
Gregg Roemhildt
@roemhildtg
Feb 15 2018 21:35
What are people's opinions on typescript? While I see the benefits, it seems like a cumbersome step to write in ts.
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:35
ts isn't usefull out of my view
but for newer coders it maybe good
there are also many alternates to typescript
when i need type checking i do that explicit
where needed
most time only on user generated values
in my application i keep care that i return the right type
but i validate user input
i think if you code small functions that do only one thing then typescript is useless
as there is no real chance for type transformation that is not wanted
if you code a big function that does a lot of if else var =
then there are more points for failures
Gregg Roemhildt
@roemhildtg
Feb 15 2018 21:45
Yeah. Makes sense. I just don't like how it puts an extra step into development. I can't just write/run code. I need to write/compile/run code. Then debugging becomes more difficult...since the original code no longer matches the actual code
Maybe it does with source maps though...but not sure how chrome handles breakpoints and such with typescript
Seems that people who like it generally come from a angular background
And dojo people for some reason
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:48
ah the most people that like it simply don't understand what it is
its a fork of javascript
microsoft does that only to get money
as always they fork of all rebrand change api
Gregg Roemhildt
@roemhildtg
Feb 15 2018 21:48
Microsoft gets money from Typescript?
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:49
and say now you got it
sure they make hell of money with it
Gregg Roemhildt
@roemhildtg
Feb 15 2018 21:49
By selling visual studio licenses?
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:49
no lol
Trainings and product lockin
we call that in the IT vendor lockin
Gregg Roemhildt
@roemhildtg
Feb 15 2018 21:50
Ah, yeah I suppose
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:50
when you can't switch tech
like facebook it got a large php codebase
they can't switch so they need to make the interpreter more performant to keep existing code
Gregg Roemhildt
@roemhildtg
Feb 15 2018 21:50
Right, typescript makes it more difficult to switch
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:51
yes and big companys will have typescript specialists from microsoft ;)
Gregg Roemhildt
@roemhildtg
Feb 15 2018 21:51
So facebook backs php? Cool I wasn't aware of that either
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:51
they back HVVM
Static Compiled PHP
Gregg Roemhildt
@roemhildtg
Feb 15 2018 21:51
Ah, interesting
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:52
thats the correct name they call it hack script
in future all this is dead
we got now consens language wide about streams
java and emca will unify the stream stuff
and both get compiled to C or the next near binary Representation
like WASM
i think soon all this interoperability issues are history
Gregg Roemhildt
@roemhildtg
Feb 15 2018 21:56
Sounds nice
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:56
yes it is
nice new future the problem will be to get all the coders aware of that consens
:D
i think the most big projects will need to switch and then the rest will follow
Thomas Sieverding
@Bajix
Feb 15 2018 21:57
WASM ftw
Frank Lemanschik
@frank-dspeed
Feb 15 2018 21:58
yes wasm is great
and it will stop the fast code upgrades
as wasm has not much space for writing better code in a diffrent style
so the versions will stay more solid
as also with the new NodeJS Abi
we now got space for all the nativ bindings
and this will also change less often version numbers as thats now solid
with node 10 we finaly drop --experimental-modules flag
so Happy ES Modules :) via .mjs files
all big mime type libs are also updated for express static and that to serve .mjs as js
so now i start under https://github.com/stealify
to rewrite canjs as Modules
Kevin Phillips
@phillipskevin
Feb 15 2018 22:07
there is a steal-typescript plugin that I wrote a while back
I don't actually have a strong opinion on typescript one way or the other
but if you're interested in trying it, you can use typescript without a build step
Gregg Roemhildt
@roemhildtg
Feb 15 2018 22:08
That would be interesting to try
Does it work with the latest steal?
Kevin Phillips
@phillipskevin
Feb 15 2018 22:08
I have no idea
I would guess that it does?
as much as it works with older versions of steal
(since no one is using it in production)
if you want to try it
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:11
@phillipskevin you should promote that more
all the react guys and angular and that are using this
so this way they could reuse code
ah no react is switched to flow i thing
Kevin Phillips
@phillipskevin
Feb 15 2018 22:11
you could promote it for me :smile:
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:12
i can't at present but i will promote that once i have forked it and writen it as es module
:D
Gregg Roemhildt
@roemhildtg
Feb 15 2018 22:12
I'm curious how it handles sourcemaps for debugging. That looks interesting
Kevin Phillips
@phillipskevin
Feb 15 2018 22:12
the typescript compiler creates sourcemaps
@frank-dspeed you don't have to fork it... if it works, you can PR into that version
I don't care
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:13
no because canjs wants cjs
Kevin Phillips
@phillipskevin
Feb 15 2018 22:14
what does this have to do with canjs?
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:14
right it has to do with stealjs
thats also at present cjs
i want all in mjs
Kevin Phillips
@phillipskevin
Feb 15 2018 22:14
ok?
I still don't understand
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:14
ok if you want i will put PR's on that
Kevin Phillips
@phillipskevin
Feb 15 2018 22:15
you'll have to have a build script, right?
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:15
i have one and i publish with dist
i use babel7 +
Kevin Phillips
@phillipskevin
Feb 15 2018 22:16
sure... I understand how to create a build step
i was just asking if you needed one
do you know if steal can handle plugins written in esm?
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:16
i don't need it for steal and ssr
so with node 10 this runs out of the box
and with steal it runs out of the box
it will only get problems with the extension maybe
but i will then make a PR to steal anyway
if steal uses the mime type like it should when it runs in the browser
then all will work out of the box
so to make it short if i understood you right you wanted to know if mjs requires a build step no it does not
Kevin Phillips
@phillipskevin
Feb 15 2018 22:18
I don't think it will work, to be honest
because the plugin would have to be loaded with a plugin
which sounds too meta to work
but :thumbsup: if it does
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:19
not really mjs is not a plugin
mjs is still the same code we write in donejs examples
import export
so if steal don't handels that i only need to tell it that it should handle mjs like js
in the browser that gets done via mime type header
Thomas Sieverding
@Bajix
Feb 15 2018 22:20
isn’t mjs just esm?
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:20
.mjs is the new modular js extension
Thomas Sieverding
@Bajix
Feb 15 2018 22:21
does it differentiate from esm in any other way
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:21
the community got consens about that to stop parsing .js files to find out what loading algo should get used
Thomas Sieverding
@Bajix
Feb 15 2018 22:21
ah
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:21
no its not really diffrent only node js handels it as es module out of the box
and nodejs got a dynamic loader support flag
Thomas Sieverding
@Bajix
Feb 15 2018 22:22
ah
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:22
to supply custom module loaders
so you can write your own bootstrap
for example as values like __dirname not exist
its a cool idea to have a dirname.js that module.exports = __dirname
rest can use mjs
with static urls
much better for the debugger
canjs complet as mjs + rewriten callback stuff to streams
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:27
then its perfect
after that stealjs in mjs + streams then feathersjs and stealify base stack is ready with backend and frontend stack :)
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:48
@phillipskevin rror: Unhandled Rejection at: Promise Promise {
<rejected> { Error: Error loading "applications@3.0.0#my.mjs" at file:/media/sf_peep-server/applications/src/my.mjs.js
you was right
stealjs don't handels mjs and node-require right
do you have a suggestion where the place could be to make it aware that it should resolve first without extension .mjs then .js then fail?
Kevin Phillips
@phillipskevin
Feb 15 2018 22:50
no idea
maybe ask in the steal room
or on the forums... might be a bigger answer
Frank Lemanschik
@frank-dspeed
Feb 15 2018 22:51
no i think no one can answer that so fast
i will reverse engineere the code
it will be somewhere with npm crawl and all that
Gregg Roemhildt
@roemhildtg
Feb 15 2018 23:09
Random question: what's a good pattern for cleaning this up? https://jsbin.com/rayenonuxa/edit?html,js,console
Frank Lemanschik
@frank-dspeed
Feb 15 2018 23:21
@phillipskevin i have a dirty hack at present that allows basic working with .mjs files directly inside donejs projects
create a empty file called js.js
do import './my.mjs!js'
it works
i also tested if my.mjs exports
it exports all well
so only steal needs mjs support
even can-import works with !js added and a empty js.js in the project