From 075864ce50dae97210b54c17e5ff6f5410e640db Mon Sep 17 00:00:00 2001 From: kobakazu0429 Date: Tue, 23 Jan 2024 13:32:31 +0900 Subject: [PATCH] fix --- package-lock.json | 50 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + rollup.config.mjs | 19 +++++++++++++----- 3 files changed, 65 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8af5fba..679c21a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "@babel/preset-env": "^7.18.2", "@babel/preset-typescript": "^7.17.12", "@biomejs/biome": "^1.5.3", + "@rollup/plugin-alias": "^5.1.0", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-replace": "^5.0.5", @@ -2357,6 +2358,38 @@ "dev": true, "optional": true }, + "node_modules/@rollup/plugin-alias": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-5.1.0.tgz", + "integrity": "sha512-lpA3RZ9PdIG7qqhEfv79tBffNaoDuukFDrmhLqg9ifv99u/ehn+lOg30x2zmhf8AQqQUZaMk/B9fZraQ6/acDQ==", + "dev": true, + "dependencies": { + "slash": "^4.0.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-alias/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@rollup/plugin-commonjs": { "version": "25.0.7", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.7.tgz", @@ -8445,6 +8478,23 @@ "dev": true, "optional": true }, + "@rollup/plugin-alias": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-5.1.0.tgz", + "integrity": "sha512-lpA3RZ9PdIG7qqhEfv79tBffNaoDuukFDrmhLqg9ifv99u/ehn+lOg30x2zmhf8AQqQUZaMk/B9fZraQ6/acDQ==", + "dev": true, + "requires": { + "slash": "^4.0.0" + }, + "dependencies": { + "slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true + } + } + }, "@rollup/plugin-commonjs": { "version": "25.0.7", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.7.tgz", diff --git a/package.json b/package.json index ae8ea89..d8dd690 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "@babel/preset-env": "^7.18.2", "@babel/preset-typescript": "^7.17.12", "@biomejs/biome": "^1.5.3", + "@rollup/plugin-alias": "^5.1.0", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-replace": "^5.0.5", diff --git a/rollup.config.mjs b/rollup.config.mjs index 1d32352..b1d5be7 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,3 +1,4 @@ +import alias from "@rollup/plugin-alias"; import cjs from "@rollup/plugin-commonjs"; import nodeResolve from "@rollup/plugin-node-resolve"; import replace from "@rollup/plugin-replace"; @@ -16,14 +17,22 @@ export default /** @type {import('rollup').RollupOptions} */ ({ format: "es", sourcemap: true, }, - { - file: pkg.exports["."].require, - format: "cjs", - sourcemap: true, - }, + // { + // file: pkg.exports["."].require, + // format: "cjs", + // sourcemap: true, + // }, ], plugins: [ + alias({ + entries: [ + ...Object.entries(pkg.overrides).map(([find, replacement]) => ({ + find, + replacement, + })), + ], + }), cjs(), nodeResolve(), replace({