Everything is right when I run the project in dev mode. But after build, when I run dist folder by live-server, this error appears: Uncaught TypeError: Cannot set properties of undefined (setting 'prototype')').

package.json:

{
  "name": "todo",
  "private": true,
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "jquery": "^3.7.1",
    "vue": "^3.2.25",
    "vue-router": "^4.3.0"
  },
  "devDependencies": {
    "@crxjs/vite-plugin": "^1.0.14",
    "@vitejs/plugin-vue": "^2.3.3",
    "vite": "^2.9.9"
  }
}

vite.config.js:

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { crx } from '@crxjs/vite-plugin'
import manifest from './manifest.json' assert { type: 'json' }
import $ from 'jquery'

export default defineConfig({
  plugins: [vue(), crx({ manifest })],
  define: {
    $: JSON.stringify($),
    jQuery: JSON.stringify($)
  }
})
0

There are 0 best solutions below