vue-winbox icon indicating copy to clipboard operation
vue-winbox copied to clipboard

require is not defined

Open marcotruffat opened this issue 1 year ago • 2 comments

I'm trying to use this component in a Vue3 project but no matter what, I keep getting this error. I created a Vue project with Vite, and it works great there. It seems like it only works with Vite?

Uncaught ReferenceError: require is not defined at eval (winbox.bundle.min.js:2:1) at ./node_modules/winbox/dist/winbox.bundle.min.js (chunk-vendors.js:2348:1) at __webpack_require__ (app.js:2854:33) at fn (app.js:3110:21) at eval (index.mjs:7:64) at ./node_modules/vue-winbox/dist/index.mjs (chunk-vendors.js:2315:1) at __webpack_require__ (app.js:2854:33) at fn (app.js:3110:21) at eval (main.js:22:69) at ./src/main.js (app.js:394:1)

PS: I managed to solve this error by removing 'type: "modules"' from the winbox package.json, but it's a temporary solution. I'd like to know if there is a definitive solution.

marcotruffat avatar Jun 28 '23 14:06 marcotruffat

Are you using webpack/vue-cli?

wobsoriano avatar Jul 01 '23 01:07 wobsoriano

Check this out. If none of the comments fixes your issue, you can patch winbox locally using patch-package and remove "type": "modules" in its package.json file.

wobsoriano avatar Jul 01 '23 02:07 wobsoriano