New version of dynamic import is breaking imports in Webpack #15706
Unanswered
studiopersona
asked this question in
General
Replies: 1 comment 1 reply
-
What is your Babel config? You don't need to compile dynamic imports if you are using webpack. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've found this new version of dynamic importing in one of our libraries that has been created by @babel/cli:
The import file cannot be found using this method with Webpack. Quoting from this article https://javascript.plainenglish.io/how-webpack-handles-dynamic-imports-with-variable-paths-9c598a2aa4e3:
By using
require(s)
there is no explicit string for Webpack to use and the import always fails, withERROR: Cannot find module
.I have been able to prove this is the issue by replacing the variable
s
in the code above with a the string"./../block/"
, so we haverequire("./../block/")
. After doing this the import can be found.Here is the previous version of dynamic importing, which worked, in which you can see the
require()
parameter is set as a string:How do we go about getting this issue resolved, without having to resort to requiring an older version of @babel/cli?
Beta Was this translation helpful? Give feedback.
All reactions