Changelog
8.0.0 (2020-04-29)
For native ECMAScript Module (ESM) usage in Node.js only named exports are exposed, there is no more default export.
-import uuid from 'uuid';
-console.log(uuid.v4()); // -> 'cd6c3b08-0adc-4f4b-a6ef-36087a1c9869'
+import { v4 as uuidv4 } from 'uuid';
+uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
Deep requiring specific algorithms of this library like require('uuid/v4')
, which has been deprecated in uuid@7
, is no longer supported.
Instead use the named exports that this module exports.
For ECMAScript Modules (ESM):
-import uuidv4 from 'uuid/v4';
+import { v4 as uuidv4 } from 'uuid';
uuidv4();
For CommonJS:
-const uuidv4 = require('uuid/v4');
+const { v4: uuidv4 } = require('uuid');
uuidv4();