-
Notifications
You must be signed in to change notification settings - Fork 254
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
TypeError: lib.init is not a function #396
Comments
@ruleeeer Could you help me with this issue? |
Same problem with vite |
I have the same problem 😢 |
I got it fixed. Add |
@mjangir could you share your |
@mostafa-raafat |
Our remote app is a CRA application with CRACO module federation config which produces a webpack library output. |
I am facing the same issues. In my case I am setting up react.js + typescript + vite project as parent to use the remote project which uses webpack and vue.js. I tried everything in this thread however I still face the same issue. |
Do you use this? It causes such an error as well: // webpack.config.js
// ...
optimization: {
// ...
runtimeChunk: 'single'
} |
I get the same issue, can anyone provide any suggestions? |
I am having same issue with Vite Host and React Webpack remote. |
@ruleeeer Do you have any updates about this issue as it's really critical? |
having the same issue that trying to use a webpack remote module from vite host, and keep seeing this :
Really appreciate if anyone can share a working case with the configs, solutions or best practices. |
Hello everyone I have a good news today. I was able to create a working demo |
Hi @mostafa-raafat I'm new to the federation and I having the same issue when using the nextjs, do you have any idea how to fix this? Thanks. |
Hi @hendry91 did you update vite configuration build output format to |
@mostafa-raafat Thank for you reply, I've added the |
Hi @mostafa-raafat, may I ask any solution for #396 (comment) ? cause I also face same issue. Really appreciate can share some solutions. Thanks |
I'm not sure why, but I did indeed resolve this issue. It might be related to the shared and manualChunks configurations. In two new Vite Vue projects, when I configured manualChunks and shared for the remote module, Vue was bundled into a new file with a different name, and the host could use it. However, in an existing online project, I encountered a lib.init problem when I configured shared along with `manualChunks. |
try manualChunks shared |
if add manualChunks options,what happen |
Hello, are there any updates on this? Have the same error |
is there any update? still have the same issue Host = Vite i try to understand is it "safe" to take this plugin to work with remote Webpack, cause currently AFAIS there is no solution for that :( Thanks 4 your effort |
any update on this? still facing the same error |
@mostafa-raafat Can you please share the configs of both the remote and host? |
I am stuck still. Using Webpack in the remote and vite in host. It keeps on saying lib.init is not a function. Tried all the means @mostafa-raafat |
FWIW, for a vite application loading webpack federated modules, there were a few things that had to be in place for me to load them successfully: HOST:
REMOTE:
Hope that helps |
it have worked for me, thanks ! |
@GabrielBursi could you share full vite and webpack config? Thanks in advance |
remote (webpack) host (vite) |
Just trying to load a webpack remote That I'm sure 100% it work as i use it in other webpack projects.
As you can see it load with 200 so the
url
itself is correctVersions
originjs: ^1.2.1
node: 15.14.0
And this is a child vite.config.js I tried to use
'var' | 'esm' | 'systemjs'
but all of them return same errorWhat is Expected?
to display the remote entry in my parent component
What is actually happening?
nothing loads and throws lib.init is not a function error
The text was updated successfully, but these errors were encountered: