diff --git a/examples/qrcode.js b/examples/qrcode.js index d078f8aa..ceaae621 100644 --- a/examples/qrcode.js +++ b/examples/qrcode.js @@ -2,7 +2,7 @@ * @module QRCode * @package @nuintun/qrcode * @license MIT - * @version 3.2.0 + * @version 3.3.0 * @author nuintun * @description A pure JavaScript QRCode encode and decode library. * @see https://github.com/nuintun/qrcode#readme diff --git a/package.json b/package.json index 5ced76e1..5cab586b 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,15 @@ { "name": "@nuintun/qrcode", - "version": "3.2.0", + "version": "3.3.0", "description": "A pure JavaScript QRCode encode and decode library.", - "main": "cjs/index.js", + "type": "module", + "main": "cjs/index.cjs", "module": "esm/index.js", "types": "types/index.d.ts", + "exports": { + "import": "./esm/index.js", + "require": "./cjs/index.cjs" + }, "files": [ "cjs", "esm", diff --git a/tools/clean.js b/tools/clean.js index bdbdf4bc..b772d13b 100644 --- a/tools/clean.js +++ b/tools/clean.js @@ -2,7 +2,7 @@ * @module clean */ -const rimraf = require('rimraf'); +import rimraf from 'rimraf'; function clean(paths) { paths = Array.isArray(paths) ? paths : [paths]; diff --git a/tools/rollup.base.js b/tools/rollup.base.js index e5f02eb0..db7862d2 100644 --- a/tools/rollup.base.js +++ b/tools/rollup.base.js @@ -26,7 +26,9 @@ export default function rollup(esnext) { exports: 'auto', esModule: false, dir: esnext ? 'esm' : 'cjs', - format: esnext ? 'esm' : 'cjs' + format: esnext ? 'esm' : 'cjs', + entryFileNames: `[name].${esnext ? 'js' : 'cjs'}`, + chunkFileNames: `[name].${esnext ? 'js' : 'cjs'}` }, external: ['tslib'], preserveModules: true,