Open xiaobeilo opened 3 years ago
@xiaobeilo added vite support in v5.4.0. You can update uniqid now. There's also a vite example in the examples folder. you will need to install the vite dependencies in the vite-project. The example is in the HelloWorld.vue component.
Let me know if this fixes it for you.
It's working fine! Thanks for the revision!👍
When uniqID is imported into vite, the following error occurs:
require_os(...).networkInterfaces is not a function
After checking the code, it is because of this code:if(typeof __webpack_require__ !== 'function'){ var mac = '', networkInterfaces = require('os').networkInterfaces(); loop: for(let interface_key in networkInterfaces){ const networkInterface = networkInterfaces[interface_key]; const length = networkInterface.length; for(var i = 0; i < length; i++){ if(networkInterface[i] !== undefined && networkInterface[i].mac && networkInterface[i].mac != '00:00:00:00:00:00'){ mac = networkInterface[i].mac; break loop; } } } address = mac ? parseInt(mac.replace(/\:|\D+/gi, '')).toString(36) : '' ; }
Because __webpack_require__ does not exist in vite, the code that enters it will report an error