-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
Scripts don't work when I use getScriptTags().replace(/async/gi, 'defer'); hackaround #685
Comments
There is opened PR with webpack 5 related fix - #676 |
@theKashey Thank you for getting back to me. import 'babel-polyfill'
import { loadableReady } from '@loadable/component';
loadableReady(() => {
ReactDom.hydrate(<Home />, document.querySelector('#root'));
}); Which causes another nasty error though. Uncaught Error: only one instance of babel-polyfill is allowed I will test if there is an alternative for |
polyfills should be imported before everything, however, importing them manually is not a good idea - babel can inject required ones by itself (not covering polyfills required for node_modules) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi, I have the same problem, did you manage to solve this error? |
🐛 Bug Report
Hi,
I'm trying "replacing async with defer" hackaround proposed in #653 to use loadable-components in conjunction with webpack 5.
Thank a lot. This hackaround banished all nasty error messages.
However, when I use this method, code-splitted components are rendered statically--in those components, all useState or useEffect gimmicks don't work, and the output of console.log is displayed only on server side.
To Reproduce
on server side,
on client side,
The above codes render like this;
You'd think you could increase the number by clicking the button, wouldn't you?
Actually you couldn't...
I'd appreciate it if someone'd shed some lights on it.
Expected behavior
Script tags work in component
(The output of console.log() is displayed both on server and client sides,
Tne number increases when the button is clicked)
Link to repl or repo (highly encouraged)
https://github.com/SkipEveryLunch/loadable-test
Run
npx envinfo --system --binaries --npmPackages @loadable/component,@loadable/server,@loadable/webpack-plugin,@loadable/babel-plugin --markdown --clipboard
The version of webpack is 5.4.0
The text was updated successfully, but these errors were encountered: