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

async js chunks that include css imports cause => Uncaught (in promise) TypeError: Cannot read property 'call' of undefined #4130

Closed
shalkam opened this issue Mar 9, 2018 · 9 comments

Comments

@shalkam
Copy link

shalkam commented Mar 9, 2018

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes

npm --version
5.7.1

Which terms did you search for in User Guide?

async js chunks that include css imports cause => Uncaught (in promise) TypeError: Cannot read property 'call' of undefined

Environment

  1. node -v: v8.2.1
  2. npm -v: 5.7.1
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts (if you haven’t ejected): [email protected]

Then, specify:

  1. Operating system: Ubuntu
  2. Browser and version (if relevant): Chromium

Steps to Reproduce

//===== a.js =====
import './common';

//===== b.js =====
import './common';

//===== common.js =====
import './common.css';
import ('./async.js'); // async import

//===== async.js =====
import './async.css'

Expected Behavior

To have async.css working in an async chunk after running npm run build

Actual Behavior

Uncaught (in promise) TypeError: Cannot read property 'call' of undefined
at webpack_require (bootstrap 3d99482…:52)
at Object.95 (async.css:1)
at webpack_require (bootstrap 3d99482…:52)
at Object.96 (async.css?eb60:4)
at webpack_require (bootstrap 3d99482…:52)
at Object.94 (0.cb65e0.chunk.js:8)
at webpack_require (bootstrap 3d99482…:52)

Reproducible Demo

Well, it's a webpack issue in the first place - but also happening with cra - it's described in details here with reproduction steps:
webpack-contrib/extract-text-webpack-plugin#456

Along with a repo to reproduce the error:
https://github.com/ericnoguchi/webpack-testing

@Timer Timer added this to the 100.0.0 milestone Mar 9, 2018
@Timer Timer modified the milestones: 100.0.0, 2.x Mar 9, 2018
@ricxsar
Copy link

ricxsar commented Jun 5, 2018

I'm also experiencing the same issue on images. Is there any workaround on this issue?

@bugzpodder
Copy link

Would you mind testing out [email protected] release and see if it happens there?

@ricxsar
Copy link

ricxsar commented Jun 5, 2018

I have existing app at the moment. How to install it?

@ricxsar
Copy link

ricxsar commented Jun 5, 2018

Never mind. I manage to install it but the react-scripts used in it is 1.1.4 which is I tested with the same result.

@bugzpodder
Copy link

@ricxsar simply replace 1.14 with 2.0.0-next.66cc7a90 in your package.json, and do npm install or yarn.

@ricxsar
Copy link

ricxsar commented Jun 6, 2018

Sorry for the late reply. I was able to test it using the 2.0.0-next.66cc7a90 but with the same result. I was able to remove the problem by not using the importing feature of reactjs of images but the images will not be available for offline use which is unfortunate.

@bugzpodder
Copy link

Thanks for looking into it!

@Timer Timer removed this from the 2.x milestone Nov 2, 2018
@stale
Copy link

stale bot commented Dec 2, 2018

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Dec 2, 2018
@stale
Copy link

stale bot commented Dec 8, 2018

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

@stale stale bot closed this as completed Dec 8, 2018
@lock lock bot locked and limited conversation to collaborators Jan 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants