Giter Club home page Giter Club logo

Comments (8)

wkei avatar wkei commented on May 30, 2024 1

@zgid123 here is a demo about antd/message/notification + vite-federation setup can reproduce the issue

https://stackblitz.com/edit/vitejs-vite-r6clfz?file=apps%2Fcontainer%2Fsrc%2FApp.tsx,README.md&terminal=dev

however, if we also use antd/message/notification in the host, antd/message/notification in remote app will also work

from vite-plugin-federation.

zgid123 avatar zgid123 commented on May 30, 2024 1

I will have a look later, currently, I am having problem with chakra-ui and this package new version. Don't know the reason yet. I will help the author to have a look at your issue after I solved my issue

from vite-plugin-federation.

Adolph-WSY avatar Adolph-WSY commented on May 30, 2024

@Volene
If possible, please provide a project to help us quickly locate whether the problem is from the configuration or something else.

from vite-plugin-federation.

Volene avatar Volene commented on May 30, 2024

Shared module cause this error but i dont know how to fix it
image

from vite-plugin-federation.

zgid123 avatar zgid123 commented on May 30, 2024

I also faced this problem when testing shared packages for chakra-ui.

Here my demo repository: https://github.com/zgid123/vite-module-federation-demo.

Please uncomment those packages in vite.config.ts of monoApp folder

// '@emotion/react': '*',
// '@emotion/styled': '*',
// 'framer-motion': '*',

I don't know if sharing those packages can solve other problem or not, but when I tested antd, I can fix that problem

from vite-plugin-federation.

zgid123 avatar zgid123 commented on May 30, 2024

I changed the code to skip add dep when the orderByDepCount[i] is undefined

      for (let i = 0; i < orderByDepCount.length; i++) {
        if (i === 0) {
          for (const key of orderByDepCount[i].keys()) {
            priority.push(key)
          }
        } else {
          for (const entries of orderByDepCount[i].entries()) {
            addDep(entries, priority, depInShared)
          }
        }
      }

I can build now but still receive the error

__federation_shared_react-dom.js:21 Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at p (__federation_shared_react.js:12)
    at Object.o.useMemo (__federation_shared_react.js:12)
    at react.js:292
    at di (__federation_shared_react-dom.js:19)
    at es (__federation_shared_react-dom.js:19)
    at Ds (__federation_shared_react-dom.js:23)
    at zs (__federation_shared_react-dom.js:23)
    at kf (__federation_shared_react-dom.js:23)
    at Dt (__federation_shared_react-dom.js:23)
    at ji (__federation_shared_react-dom.js:21)
__federation_shared_react-dom.js:8 Uncaught Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at p (__federation_shared_react.js:12)
    at Object.o.useMemo (__federation_shared_react.js:12)
    at react.js:292
    at di (__federation_shared_react-dom.js:19)
    at es (__federation_shared_react-dom.js:19)
    at Ds (__federation_shared_react-dom.js:23)
    at zs (__federation_shared_react-dom.js:23)
    at kf (__federation_shared_react-dom.js:23)
    at Dt (__federation_shared_react-dom.js:23)
    at ji (__federation_shared_react-dom.js:21)

If you had faced this error before, please help me to fix this. Only occur with chakra-ui, I tested with antd, there is no problem. I am trying to fix this, but still no luck.

from vite-plugin-federation.

nielsonlien avatar nielsonlien commented on May 30, 2024

hi @zgid123 , I have a problem with antd notification component (https://ant.design/components/notification/), this component works fine on my remote app on development mode, but when i build in production mode (host and mono app), it gives an error as below.

image
image

I suspect there is an import problem. Following is my vite config and package.json. Do i need to make my antd as shared dependencies? Appreciate, if you could let me know what is the problem. Thanks.

image
image

from vite-plugin-federation.

zgid123 avatar zgid123 commented on May 30, 2024

@nielsonlien can you provide a sample project? Because I only tested antd to make sure if it worked. I don't use antd for my side project

from vite-plugin-federation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.