-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when importing uniqID in vite project #40
Comments
@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!👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: