Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React (nested) code splitting and SASS results in component not loaded #9

Open
martinoss opened this issue Aug 30, 2018 · 6 comments
Open

Comments

@martinoss
Copy link

martinoss commented Aug 30, 2018

I've got a strange problem using sass and code splitting, probably with nesting only.

What happened is, my imported component (using loadable) did not load in production build. I din't get any kind of error or indication what's wrong.

Structure is as follows:

image

When I import the sass file person-list.scss in PersonList.tsx it requires me to import a (dummy) sass file in PersonsRoot.tsx too, otherwise the component PersonsList will not get loaded.

This is what I use in my project: create-react-app (react-scripts-ts), react-router 4, redux 4, react-app-rewired, react-app-rewire-scss

Here I uploaded a project to github for easy reproduction:

Am I doing something wrong or is it maybe a bug?

I'have also posted this issue on stackoverflow

Update:
Webpack seems to have an array of 545 modules but tries to access the element with index 545 which is of course undefined (0 based index).

part1
part2

TypeError: Cannot read property 'call' of undefined

o (main.9cac5c4f.js:formatted:26)
544 (persons-list.scss:1)
o (main.9cac5c4f.js:formatted:26)
543 (persons-list.scss?3174:4)
o (main.9cac5c4f.js:formatted:26)
542 (1.56e5fc78.chunk.js:1)
o (main.9cac5c4f.js:formatted:26)
Promise.then (async)
loader (routes.ts:6)
f (main.9cac5c4f.js:formatted:6499)
v (main.9cac5c4f.js:formatted:6566)
n (main.9cac5c4f.js:formatted:6591)
Ii (main.9cac5c4f.js:formatted:11110)
da (main.9cac5c4f.js:formatted:11833)
ha (main.9cac5c4f.js:formatted:11854)
Ga (main.9cac5c4f.js:formatted:12109)
Ya (main.9cac5c4f.js:formatted:12068)
Ha (main.9cac5c4f.js:formatted:12056)
za (main.9cac5c4f.js:formatted:12011)
ba (main.9cac5c4f.js:formatted:11941)
enqueueSetState (main.9cac5c4f.js:formatted:10547)
O.setState (main.9cac5c4f.js:formatted:7392)
t (main.9cac5c4f.js:formatted:6630)
(anonymous) (main.9cac5c4f.js:formatted:6638)
Promise.then (async)
n._loadModule (main.9cac5c4f.js:formatted:6637)
n.componentWillMount (main.9cac5c4f.js:formatted:6608)
li (main.9cac5c4f.js:formatted:10594)
Ii (main.9cac5c4f.js:formatted:11117)
da (main.9cac5c4f.js:formatted:11833)
ha (main.9cac5c4f.js:formatted:11854)
Ga (main.9cac5c4f.js:formatted:12109)
Ya (main.9cac5c4f.js:formatted:12068)
Ha (main.9cac5c4f.js:formatted:12056)
za (main.9cac5c4f.js:formatted:12011)
ba (main.9cac5c4f.js:formatted:11941)
ou (main.9cac5c4f.js:formatted:12498)
au (main.9cac5c4f.js:formatted:12508)
hu.render (main.9cac5c4f.js:formatted:12705)
(anonymous) (main.9cac5c4f.js:formatted:12599)
eu (main.9cac5c4f.js:formatted:12435)
vu (main.9cac5c4f.js:formatted:12598)
render (main.9cac5c4f.js:formatted:12755)
(anonymous) (main.9cac5c4f.js:formatted:7334)
o (main.9cac5c4f.js:formatted:26)
(anonymous) (main.9cac5c4f.js:formatted:6753)
o (main.9cac5c4f.js:formatted:26)
(anonymous) (main.9cac5c4f.js:formatted:100)
(anonymous) (main.9cac5c4f.js:formatted:101)
@AndyOGo
Copy link

AndyOGo commented Aug 31, 2018

guess this is related webpack/webpack#7499

Could be a problem with sideEffects of webpack treeshaking...

@AndyOGo
Copy link

AndyOGo commented Aug 31, 2018

and webpack/webpack#7425

@AndyOGo
Copy link

AndyOGo commented Sep 2, 2018

@aze3ma
Did you have any chance to look into this?

@AndyOGo
Copy link

AndyOGo commented Sep 3, 2018

@martinoss
Unfortunately there is no plan/time to maintain react-app-rewired:
timarney/react-app-rewired#162 (comment)

@AndyOGo
Copy link

AndyOGo commented Sep 4, 2018

Guess it's caused by create-react-app-typescript/react-scripts-ts
wmonk/create-react-app-typescript#390

@aze3ma
Copy link
Owner

aze3ma commented Sep 6, 2018

@AndyOGo Iam sorry for being that busy I will clone it and try to fix it asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants