-
Notifications
You must be signed in to change notification settings - Fork 4
[module-federation-runtime] Warnings importing as a CommonJs module #13
Comments
The warning critical dependency is correct, just ignore it, the reason is the code in dist/node : "undefined"!=typeof __non_webpack_require__?__non_webpack_require__:require |
This error is because your webpackconfig.js does not have target: "node" configured. You need to first confirm whether you need to use dist/node and whether you can directly use dist/index.js You can also send a minimum reproducible example |
I have a React app so This is a legacy application that I'm trying to support, so unfortunately I can not upgrade the Node version either. |
dist and dist/node are both umd modules, not es modules |
Isn’t the dist/index.js file an ES module? In your rollup config you have the format set to “es” (line 14). Anyways, both the UMD module or the CJS module should work for my use case. Can you take a look at the PR that I raised to define the different entry points? It should just be an enhancement so that I can import like |
yes, I remember wrong. There is indeed an ES module present the browser environment defaults to using es: dist/index, and dist/umd/index is also optional . |
Although you are Node12, the ES module can still be introduced through webpack. Will there be any exceptions if you directly use the following code? import "module-federation-runtime" |
I have a React application using Node 12, so I can not use ES modules. When I try to import the
module-federation-runtime
package as a Common JS module like this:I get these warnings:
and
The text was updated successfully, but these errors were encountered: