how to config externalGlobals when use @floating-ui/dom #229
Replies: 2 comments 6 replies
-
import { defineConfig } from 'vite';
import monkey, { cdn } from 'vite-plugin-monkey';
import floatingPkg from '@floating-ui/dom/package.json';
export default defineConfig(({ command }) => {
return {
plugins: [
monkey({
entry: 'src/main.ts',
userscript: {
icon: 'https://vitejs.dev/logo.svg',
namespace: 'npm/vite-plugin-monkey',
match: ['https://github.com/'],
require: [
command === 'build'
? `https://cdn.jsdelivr.net/npm/@floating-ui/core@${floatingPkg}/dist/floating-ui.core.umd.min.js`
: '',
].filter(Boolean),
},
build: {
externalGlobals: {
'@floating-ui/dom': cdn.jsdelivr(
'FloatingUIDOM',
'dist/floating-ui.dom.umd.min.js',
),
},
},
}),
],
};
}); or
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
chanchancl
-
感谢,我下午也感觉是这个 core 的问题,但是通过 externalGlobals 来导入 core 也不行,鼓捣半天,不如来问大佬 下面是可以通过编译的配置:
|
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
一直会显示这个错误:
vite.config.ts
下面是一个空的工程
test-t.zip
Beta Was this translation helpful? Give feedback.
All reactions