Giter Club home page Giter Club logo

Comments (4)

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

@flyfishzy @ruleeeer

Some other scenarios:
In branch feat-vue-treeshake, home use element-plus, common-lib use vue only. The vue generated by packaging has different exports in these two project.
If layout(host) want use components from these two project, 'Uncaught (in promise) TypeError: createBaseVNode is not a function' will happen.

from vite-plugin-federation.

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

Idea 1: Prevent rollup from extracting common code.
Idea 2: Restore the Aggregating file generated by rollup

from vite-plugin-federation.

flyfishzy avatar flyfishzy commented on May 30, 2024
  • try idea 1
    We use multiple entry points for code splitting. In this example, the input entry will be:
input: {
    index: '\\vue3-demo\\layout\\index.html',
    __rf_input__vue: 'vue',
    __rf_input__vuex: 'vuex',
    '__rf_input__element-plus': 'element-plus'
  },

The dependency graph is:

index -> element-plus -> vue
index -> vue

Rollup will never duplicate code and instead create additional chunks to only ever load the bare minimum necessary.

The dist bundle of vue will have 2 files, vue.74c5cc83.js is the main logic, while __rf_input__vue.c614e824.js has only imports/exports.

I have tried to set output.hoistTransitiveImports to false, but it makes no difference.

from vite-plugin-federation.

ruleeeer avatar ruleeeer commented on May 30, 2024

I will try to block the removal of the multi-generated dependency file, use the proxy to proxy the original dependency, and analyze the differences between the two files to add the missing export to the proxy

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.