-
|
Using opencv-ts (opencv with ts wrapper) in vite is not working. I realized it is related with commonjs ,esmodule, or like something... but i can't understand i tried to change vite.config.ts but nothing worked. import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { esbuildCommonjs, viteCommonjs } from '@originjs/vite-plugin-commonjs'
import { builtinModules } from 'module'
import commonjs from '@rollup/plugin-commonjs';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [commonjs(), vue()],
// optimizeDeps: {
// esbuildOptions: {
// plugins: [
// esbuildCommonjs(['opencv-ts'])
// ]
// }
// },
build: {
commonjsOptions: {
transformMixedEsModules: true,
include: ["opencv-ts"]
}
}
})check my repo main branch it crash immediately after open browser. |
Beta Was this translation helpful? Give feedback.
Answered by
naramdash
Oct 12, 2021
Replies: 1 comment 5 replies
-
|
okay, i solved this problem by add define on vite.config.ts import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
define: {
Module: {} // this
}
})
``
It doesn't look good, but it works for now. |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
naramdash
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


okay, i solved this problem by add define on vite.config.ts