-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
dynamic imports not working with typescript #3389
Comments
tsconfig -> "module": "esnext", take a try! |
@blinkcat this seems to work somewhat but then I get a bunch of
and so on also I have to do
instead of
and it seems that I have to do that for everything else.
then I wonder why in the typescript example the options is set to |
@johhansantana that example is too simple. if you don't set "module": "esnext", tsc will compile ‘dynamic import’ to Promise.resolve().then..., which will cause error you mentioned above. And, i also set "allowSyntheticDefaultImports": true, this may help. |
@timneutkens , How do you fixed |
I am also having problem with dynamic importing on next-typescript. |
it's not released yet. Will be available soon. |
any idea when dynamically importing files with next-typescript will be working? Its one of the few steps I have left for a ts boilerplate with next! dirty fix: Create a seperate js file for all your dynamic imports, then export them as such:
Now you can import them to your tsx files error free! |
I see that the code splitting is successful, but still shows the error
event though my tsconfig.json has correct module and allowSyntheticDefaultImports
|
I'm getting this error message:
Here's my code:
this gets compiled via typescript and the result is this:
and if I use
I get:
tsconfig:
The text was updated successfully, but these errors were encountered: