Skip to content

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

Closed
@shalkam

Description

@shalkam

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions