Open richex-cn opened 1 year ago
hi, you need change the plugin
// import externalGlobals from 'rollup-plugin-external-globals'
import { viteExternalsPlugin } from 'vite-plugin-externals'
export default defineConfig({
plugins: [
vue(),
Components({
dirs: ['src/components'],
dts: 'src/components.d.ts',
resolvers: [AntDesignVueResolver()]
}),
viteExternalsPlugin({
vue: 'Vue',
})
],
build: {
minify: false,
rollupOptions: {
// external: ['vue'],
// plugins: [
// externalGlobals({
// vue: 'Vue'
// })
// ]
}
}
})
@lishaobos Thanks, It works for me!
I think this issue should remain open and it may be an issue that needs to be followed up.
Describe the bug
When I enable global and external in rollupOptions for Vue by rollup-plugin-external-globals, The ant-design-vue component will not be automatically introduced at build time.
Primary code like (see vite.config.ts in reproduce):
When development (
pnpm run dev
), render code like:When production (
pnpm run build
), render code like:Looks like the ant-design-vue components is not being imported at build time.
Reproduction
https://github.com/richex-cn/issue-unplugin-vue-components-rollup-plugin-external-globals
System Info
Used Package Manager
pnpm
Validations