JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
Feb 6, 2018 09:15
anyone tried to make SSR + AsyncComponent work, outside of Routes? I mean using AsyncCmp in another cmps...
Jan 31, 2018 14:08
And if it goes into index.js for some reason it imports some other cmps as well
Jan 31, 2018 14:07
if I use relative path '../Icon'; Jest works
Jan 31, 2018 14:07
in Avatar.js which I want to test I import Icon like this. import { Icon } from 'components';
Jan 31, 2018 14:06
Jan 31, 2018 14:06
Anyone have an idea why would Jest make such stack trace?
Jan 29, 2018 20:47
damn I did not knew the rules!
Jan 29, 2018 20:47
thanks
Jan 29, 2018 20:47
:D
Jan 29, 2018 20:46
omg try and catch
Jan 29, 2018 20:45
await foo().catch(error => console.log(error)); ?
Jan 29, 2018 20:44
am using some async functions, but no promises...
Jan 29, 2018 20:43
anyone have a clue?
Jan 29, 2018 20:43
I have react ssr / webpack...
Jan 29, 2018 20:43
Jan 26, 2018 21:07
thanks
Jan 26, 2018 21:07
shit no
Jan 26, 2018 21:07
"http://localhost:8080/embed/1.bundle.js"
Jan 26, 2018 21:07
Webpack chunks issue:
GET http://localhost:8080/embed/1.bundle.js net::ERR_ABORTED

Chunk tried to be loaded from relative path (relative to the current url) instead of loading it from the root. So after :8080/1.bundle.js...
Jan 26, 2018 19:35
React - SSR and chunks. I load base bundle but client code does not get initiated for some reason. It worked before I introduced chunks. Now chunks work in dev but not on SSR. Any idea, based on this shitty description?
Jan 25, 2018 15:43
within the React + Webpack env
Jan 25, 2018 15:43
in async method
Jan 25, 2018 15:43
const Component = await import(../embeds/${cmpId});
Jan 25, 2018 15:43
so this would work
Jan 25, 2018 15:42
Do anyone knows if import() supports dynamic paths?
Jan 25, 2018 15:41
it is what caused the funky behavior...
Jan 25, 2018 15:41
@Mosho I had this
const Component = require(`../embeds/${cmpId}`)[cmpId];
Jan 25, 2018 14:57
but it is nice to say thanks
Jan 25, 2018 14:57
@Mosho I still did not solved sadly
Jan 25, 2018 14:51
thanks guys!
Jan 25, 2018 14:51
@Mosho you are right
Jan 25, 2018 14:45
even if there is reference to this enzyme resource
Jan 25, 2018 14:45
am not sure why it bundles spanshot @Mosho
Jan 25, 2018 14:43
since there is one file for testing which imports enzyme
Jan 25, 2018 14:43
but don't have clue how to solve
Jan 25, 2018 14:42
I know where sadly
Jan 25, 2018 14:42
yeah
Jan 25, 2018 14:42
which makes bundle huge
Jan 25, 2018 14:42
and if I remove the externals property from webpack config it builds enzyme as well :D
Jan 25, 2018 14:41
spent a day debugging that
Jan 25, 2018 14:40
yeah I am so pissed atm tbh
Jan 25, 2018 14:40
yeah
Jan 25, 2018 14:39
my bundle is 493 bytes then :D
Jan 25, 2018 14:38
just a sec
Jan 25, 2018 14:38
I have no reference to the tests in import
Jan 25, 2018 14:37
exactly
Jan 25, 2018 14:35
this is for web app
Jan 25, 2018 14:35
even in the production bundles?
Jan 25, 2018 14:34
You suggest to try with common chunks?
Jan 25, 2018 14:34
thanks for saying that. Am a bit confused, why would test even be in any bundle