From d41a80c772573306bf2641cc747fc80ff38bec65 Mon Sep 17 00:00:00 2001 From: Zhiyuan Liang <141655842+zhiyuanliang-ms@users.noreply.github.com> Date: Sun, 9 Nov 2025 15:21:41 +0800 Subject: [PATCH] Fix rollup (#241) * fix rollup * update comment * update --- package.json | 7 +++---- rollup.config.mjs | 18 ++---------------- tsconfig.json | 18 ++++++++++++++---- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index f3b21a75..b61d93b3 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "The JavaScript configuration provider for Azure App Configuration", "files": [ "dist/", - "types/", "LICENSE", "README.md" ], @@ -12,11 +11,11 @@ "./package.json": "./package.json", ".": { "import": { - "types": "./types/index.d.ts", + "types": "./dist/types/index.d.ts", "default": "./dist/esm/index.js" }, "require": { - "types": "./types/index.d.ts", + "types": "./dist/types/index.d.ts", "default": "./dist/commonjs/index.js" } } @@ -26,7 +25,7 @@ "build-test": "npm run build-test-esm && npm run build-test-cjs", "build-test-esm": "tsc -p ./tsconfig.test.esm.json && cpy esm-package.json out/esm --rename=package.json", "build-test-cjs": "tsc -p ./tsconfig.test.cjs.json && cpy cjs-package.json out/commonjs --rename=package.json", - "clean": "rimraf dist dist-esm out types", + "clean": "rimraf dist out", "dev": "rollup --config --watch", "lint": "eslint src/ test/ examples/ --ext .js,.ts,.mjs", "fix-lint": "eslint src/ test/ examples/ --fix --ext .js,.ts,.mjs", diff --git a/rollup.config.mjs b/rollup.config.mjs index b7c3f495..b9c547c4 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -31,27 +31,13 @@ export default [ ], plugins: [ typescript({ - compilerOptions: { - "lib": [ - "DOM", - "WebWorker", - "ESNext" - ], - "skipDefaultLibCheck": true, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "target": "ES2022", - "strictNullChecks": true, - "strictFunctionTypes": true, - "sourceMap": true, - "inlineSources": true - } + tsconfig: "./tsconfig.json", }) ], }, { input: "src/index.ts", - output: [{ file: "types/index.d.ts", format: "esm" }], + output: [{ file: "dist/types/index.d.ts", format: "esm" }], plugins: [dts()], }, ]; diff --git a/tsconfig.json b/tsconfig.json index 837eaf61..e2538401 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,30 @@ { "compilerOptions": { + // Include ES2022 (modern JS), ESNext (future features), DOM and web worker APIs for browser support. "lib": [ "DOM", "WebWorker", "ESNext", "ES2022" ], - "skipDefaultLibCheck": true, - "moduleResolution": "Node", + // Generate modern JavaScript syntax compatible with Node 18+ and modern browsers. "target": "ES2022", + + // Use Node-style resolution to locate imports + "moduleResolution": "Node", + + // Allow default imports from CommonJS modules. + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + + // Ensure strict type-checking "strictNullChecks": true, "strictFunctionTypes": true, + "skipDefaultLibCheck": true, + + // Generate source maps and inline original TypeScript sources for debugging. "sourceMap": true, "inlineSources": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true }, "exclude": [ "node_modules",