originjs / vite-plugin-federation

Module Federation for vite & rollup
Other
2.4k stars 242 forks source link

shared module which export default function like dayjs will get error TypeError: xxx is not a function #537

Closed unformalized closed 1 year ago

unformalized commented 1 year ago

Versions

Reproduction

none

Steps to reproduce

remote side:

// vite.config.ts
plugins: [
    federation({
      name: 'demo',
      filename: 'remoteEntry.js',
      remotes: {
        xx:  'xxx',
      },
      shared: {
        vue: {},
        dayjs: {},
      }
    }),
  ],

// index.vue
import dayjs from 'dayjs';

dayjs().format('YYYY-MM-DD');

What is Expected?

work without problem in prod env

What is actually happening?

Typed error: dayjs is not a function in prod env

unformalized commented 1 year ago

fix pr

bustEXZ commented 1 year ago

Same issue with clsx. When this will be merged?