-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 import requires module: 'esnext' in Webpack #16820
Comments
Hi again, Looks like the problem is more fundamental. Using What I need is something like Am I missing something? Is there already any example of using |
Add |
Works like a charm! Funny that I used module resolution expression in my question but I was unable to find the configuration option. Thanks! |
@olmobrutall I also used |
Same here, it doesn't work when typescript options are set to "module": "commonjs" The only option seems to be changing typescript compile options to "module": "esnext" which then generates: (Note the require vs import difference) However there are other reasons why I won't be able to just switch to "esnext" so it would be good if someone can shine some light on this. |
@jcreamer898 did you add |
Well, so what I ended up having to do is have 2 tsconfig's, one for WebPack, and another for Node.js. Then depending on what I'm doing, either spinning up the server or running WebPack, I swap configs. |
Hi there.
I have added "moduleResolution": "node", with no luck this is what my tsconfig looks like
|
I think we cannot set module to It's give me an error like below $ ./node_modules/.bin/tsc
error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'. |
what version of |
Oops. Sorry my bad, I'm using |
Hi guys,
I just switched to using the new dynamic
import
in my webpack app but I was surprised that all the code was bundled together.The problem was that I was using
module : "commonjs"
, instead ofmodule: "esnext"
" in my tsconfig.json.I finally found my solution here (and I missed it in the the blogpost)
But is not yet document documented in the handbook neither in the json schema for the VS intellisense.
Keep the great work!
The text was updated successfully, but these errors were encountered: