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

Webpack 5 target web, es5 error #658

Closed
gempir opened this issue Nov 6, 2020 · 5 comments
Closed

Webpack 5 target web, es5 error #658

gempir opened this issue Nov 6, 2020 · 5 comments

Comments

@gempir
Copy link

gempir commented Nov 6, 2020

🐛 Bug Report

When using target ES5 in webpack I'm getting the error

Uncaught TypeError: Cannot read property '__LOADABLE_LOADED_CHUNKS__' of undefined

image
image

To Reproduce

Use webpack 5 with target: ["web", "es5"]

Expected behavior

No error appears in the console

Issues without a reproduction link are likely to stall.

System Info

## System:
 - OS: macOS 10.15.7
 - CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
 - Memory: 69.03 MB / 16.00 GB
 - Shell: 5.7.1 - /bin/zsh
## Binaries:
 - Node: 14.9.0 - /usr/local/bin/node
 - Yarn: 1.22.5 - /usr/local/bin/yarn
 - npm: 6.14.7 - /usr/local/bin/npm
## npmPackages:
 - @loadable/babel-plugin: ^5.13.2 => 5.13.2
 - @loadable/component: ^5.14.1 => 5.14.1
 - @loadable/webpack-plugin: ^5.14.0 => 5.14.0
@open-collective-bot
Copy link

Hey @gempir 👋,
Thank you for opening an issue. We'll get back to you as soon as we can.
Please, consider supporting us on Open Collective. We give a special attention to issues opened by backers.
If you use Loadable at work, you can also ask your company to sponsor us ❤️.

@theKashey
Copy link
Collaborator

Tracked in #636, but this is not known before behavior

@gempir
Copy link
Author

gempir commented Mar 5, 2021

Now that webpack and loadable-components has fixed most issues, I wanted to try this again.

But I'm still running into the same error. Can anyone maybe give any hints what the problem is related to? Maybe some part of our babel is setup weirdly? Maybe a webpack option thats weird or something?

Uncaught TypeError: Cannot read property '__LOADABLE_LOADED_CHUNKS__' of undefined

image

"@loadable/babel-plugin": "^5.13.2",
"@loadable/component": "^5.14.1",
"@loadable/webpack-plugin": "^5.14.2",
"webpack": "^5.24.3",
"webpack-cli": "^4.5.0"

@gempir
Copy link
Author

gempir commented Mar 5, 2021

Compiling with target web works fine, because that doesn't use the browserlist, but if I compile with no webpack target it will default to browserlist which includes IE11

    "browserslist": [
        "last 2 versions",
        "iOS >= 10",
        "IE >= 11"
    ],

target: ["web", "es5"] also breaks

@DimaChervan
Copy link

DimaChervan commented Oct 4, 2021

I have the same issue
Uncaught TypeError: Cannot read property '__LOADABLE_LOADED_CHUNKS__' of undefined in IE11.
I use target: ["web", "es5"] and runtimeChunk: true, webpack 5
If I understand correctly, then I receive exception because during access to this.['__LOADABLE_LOADED_CHUNKS__'] this is undefined due to 'use script' in function.
@theKashey can you help?

UPD: fixed by using globalObject: 'self'

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