You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
使用webpack的vue3项目可以直接使用npm run build打包出来的js没有异常,但该文件引入vite项目会报错‘require is not defined’
在该项目中引入vite进行打包
vite.config.js
`import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
使用webpack的vue3项目可以直接使用npm run build打包出来的js没有异常,但该文件引入vite项目会报错‘require is not defined’
在该项目中引入vite进行打包
vite.config.js
`import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue()
],
build: {
lib: {
entry: fileURLToPath(new URL('src/index.ts', import.meta.url)),
name: 'vdr',
formats: ['es'],
fileName: () =>
vdr.js
}
},
})
`
打包出来后样式初始大小等均正常,但拖拽和缩放都失效了,请问这个问题有办法解决吗?
The text was updated successfully, but these errors were encountered: