From df84fd7e62a937784ffe31470a0a6b528a06e77b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Thu, 28 Nov 2024 23:31:29 +0800 Subject: [PATCH] refactor: esm first --- eslint.config.mjs => eslint.config.js | 0 package.json | 16 ++++++---------- .../unit-tests/write-bundle/write-bundle.test.ts | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) rename eslint.config.mjs => eslint.config.js (100%) diff --git a/eslint.config.mjs b/eslint.config.js similarity index 100% rename from eslint.config.mjs rename to eslint.config.js diff --git a/package.json b/package.json index cc01a34..93d6af9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "unplugin", - "type": "commonjs", + "type": "module", "version": "1.16.0", "packageManager": "pnpm@9.14.2", "description": "Unified plugin system for build tools", @@ -12,18 +12,14 @@ "sideEffects": false, "exports": { ".": { - "types": { - "import": "./dist/index.d.mts", - "require": "./dist/index.d.ts" - }, - "import": "./dist/index.mjs", - "require": "./dist/index.js" + "import": "./dist/index.js", + "require": "./dist/index.cjs" }, - "./dist/webpack/loaders/*": "./dist/webpack/loaders/*.js", - "./dist/rspack/loaders/*": "./dist/rspack/loaders/*.js" + "./dist/webpack/loaders/*": "./dist/webpack/loaders/*.cjs", + "./dist/rspack/loaders/*": "./dist/rspack/loaders/*.cjs" }, "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/index.js", "types": "dist/index.d.ts", "files": [ "dist" diff --git a/test/unit-tests/write-bundle/write-bundle.test.ts b/test/unit-tests/write-bundle/write-bundle.test.ts index 50e9894..b0ab2d6 100644 --- a/test/unit-tests/write-bundle/write-bundle.test.ts +++ b/test/unit-tests/write-bundle/write-bundle.test.ts @@ -58,7 +58,7 @@ describe('writeBundle hook', () => { entry: path.resolve(__dirname, 'test-src/entry.js'), name: 'TestLib', fileName: 'output', - formats: ['cjs'], + formats: ['es'], }, outDir: path.resolve(__dirname, 'test-out/vite'), sourcemap: true,