vite-plugin / vite-plugin-commonjs

A pure JavaScript implementation for CommonJs
MIT License
105 stars 16 forks source link

dynamic require css is not success #49

Closed zhao-yi-fan closed 2 weeks ago

zhao-yi-fan commented 4 months ago

I want to dynamically load the components in the vant component library, But loading css styles is problematic

  "dependencies": {
    "@vitejs/plugin-vue2": "^2.3.1",
    "vant": "^2.13.2",
    "vite-plugin-commonjs": "^0.10.1",
    "vue": "^2.7.16"
  },
  "devDependencies": {
    "vite": "^4.5.3"
  }

Example https://stackblitz.com/edit/vitejs-vite-k49src?file=src%2Fmain.js

Uncaught SyntaxError: Unexpected identifier '__matchRequireRuntime0__' (at App.vue:55:46)

And finding the "vant/lib/utils/dom/style" path is also problematic

image