diff --git a/.gitignore b/.gitignore index 8fb83015..e16fa188 100644 --- a/.gitignore +++ b/.gitignore @@ -20,9 +20,9 @@ dist /cli /index.js /index.d.ts -/bundle.js -/bundle.js.map +/bundle.cjs +/bundle.cjs.map /bundle.css /bundle.css.map -/bundle.d.ts +/bundle.d.cts *.log diff --git a/package.json b/package.json index e26c2ecd..c64a62a8 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "size-limit": [ { "name": "Library / JS", - "path": "packages/reshaped/dist/bundle.js", + "path": "packages/reshaped/dist/bundle.cjs", "webpack": false }, { diff --git a/packages/reshaped/bin/clean.sh b/packages/reshaped/bin/clean.sh index 0e30ed2f..9d7b7b43 100644 --- a/packages/reshaped/bin/clean.sh +++ b/packages/reshaped/bin/clean.sh @@ -2,4 +2,4 @@ find ./src -type d -mindepth 1 -maxdepth 1 | xargs -L1 basename | xargs -L1 rm -rf rm -rf dist -rm -f index.js index.d.ts bundle.js bundle.js.map bundle.css bundle.css.map bundle.d.ts +rm -f index.js index.d.ts bundle.cjs bundle.cjs.map bundle.css bundle.css.map bundle.d.cts diff --git a/packages/reshaped/bin/cli.js b/packages/reshaped/bin/cli.js index 3864ad1e..7df48d38 100644 --- a/packages/reshaped/bin/cli.js +++ b/packages/reshaped/bin/cli.js @@ -1,2 +1,2 @@ #!/usr/bin/env node -require("@reshaped/theming/cli/run"); +import "@reshaped/theming/cli/run"; diff --git a/packages/reshaped/package.json b/packages/reshaped/package.json index c69ad96f..0407fa7e 100644 --- a/packages/reshaped/package.json +++ b/packages/reshaped/package.json @@ -41,6 +41,7 @@ "sideEffects": [ "*.css" ], + "type": "module", "types": "./dist/index.d.ts", "exports": { ".": { @@ -63,9 +64,9 @@ "default": "./dist/config/postcss.cjs" }, "./bundle": { - "types": "./dist/bundle.d.ts", - "import": "./dist/bundle.js", - "default": "./dist/bundle.js" + "types": "./dist/bundle.d.cts", + "import": "./dist/bundle.cjs", + "default": "./dist/bundle.cjs" }, "./themes/slate/*": "./dist/themes/slate/*", "./themes/figma/*": "./dist/themes/figma/*", @@ -81,7 +82,7 @@ "build:esm": "tsc -p tsconfig.esm.json && tsc-alias -p tsconfig.esm.json", "build:css": "postcss \"src/**/*.css\" --dir dist --base src --config tools/build", "build:stories": "tsc -p tsconfig.stories.json && tsc-alias -p tsconfig.stories.json", - "build:bundle": "vite build && shx cp dist/index.d.ts dist/bundle.d.ts", + "build:bundle": "vite build && shx cp dist/index.d.ts dist/bundle.d.cts", "build:size": "pnpm clean && pnpm build:esm && pnpm build:bundle", "test:browser": "vitest run --project=storybook", "test:unit": "vitest run --project=unit", diff --git a/packages/reshaped/tsconfig.esm.json b/packages/reshaped/tsconfig.esm.json index dab6bcf9..824b2968 100644 --- a/packages/reshaped/tsconfig.esm.json +++ b/packages/reshaped/tsconfig.esm.json @@ -17,5 +17,8 @@ "./src/**/*.test.tsx", "./src/**/*.test.ts", "./src/**/*.stories.tsx" - ] + ], + "tsc-alias": { + "resolveFullPaths": true + } } diff --git a/packages/reshaped/tsconfig.stories.json b/packages/reshaped/tsconfig.stories.json index 110467ff..f1096c67 100644 --- a/packages/reshaped/tsconfig.stories.json +++ b/packages/reshaped/tsconfig.stories.json @@ -5,8 +5,8 @@ "outDir": "./dist", "rootDir": "./src", "paths": { "@/*": ["./src/*"] }, - "module": "NodeNext", - "moduleResolution": "NodeNext" + "module": "esnext", + "moduleResolution": "bundler" }, "include": ["./src/**/tests/*.stories.tsx", "./src/**/*.d.ts", "./storybook/**.*.tsx"], "exclude": ["node_modules", "dist", "tools"] diff --git a/packages/reshaped/vite.config.mjs b/packages/reshaped/vite.config.mjs index 4d58372c..f815e8d8 100644 --- a/packages/reshaped/vite.config.mjs +++ b/packages/reshaped/vite.config.mjs @@ -25,8 +25,8 @@ export default defineConfig({ logLevel: "silent", external: ["react", "react/jsx-runtime", "react-dom"], output: { - entryFileNames: "bundle.js", - chunkFileNames: "[name].js", + entryFileNames: "bundle.cjs", + chunkFileNames: "[name].cjs", globals: { react: "React", "react-dom": "ReactDOM", diff --git a/packages/theming/package.json b/packages/theming/package.json index b8a812b2..da807b69 100644 --- a/packages/theming/package.json +++ b/packages/theming/package.json @@ -26,6 +26,7 @@ "sideEffects": [ "*.css" ], + "type": "module", "types": "./dist/index.d.ts", "exports": { ".": { @@ -50,8 +51,8 @@ }, "scripts": { "clean": "rm -rf dist", - "dev": "tsc-watch --onSuccess \"tsc-alias --resolve-full-paths\"", - "build": "tsc && tsc-alias --resolve-full-paths" + "dev": "tsc-watch --onSuccess \"tsc-alias\"", + "build": "tsc && tsc-alias" }, "dependencies": { "@types/culori": "4.0.1", diff --git a/packages/theming/tsconfig.json b/packages/theming/tsconfig.json index 2abd9111..a23597d8 100644 --- a/packages/theming/tsconfig.json +++ b/packages/theming/tsconfig.json @@ -11,5 +11,8 @@ } }, "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "./src/**/*.test.tsx", "./src/**/*.test.ts"] + "exclude": ["node_modules", "dist", "./src/**/*.test.tsx", "./src/**/*.test.ts"], + "tsc-alias": { + "resolveFullPaths": true + } } diff --git a/packages/utilities/package.json b/packages/utilities/package.json index ffc73a0d..c3796931 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -20,6 +20,7 @@ "files": [ "dist/**/*" ], + "type": "module", "types": "./dist/index.d.ts", "exports": { ".": { diff --git a/packages/utilities/tsconfig.json b/packages/utilities/tsconfig.json index ff567495..8e17503b 100644 --- a/packages/utilities/tsconfig.json +++ b/packages/utilities/tsconfig.json @@ -9,5 +9,8 @@ "paths": { "@/*": ["./src/*"] } }, "include": ["src/**/*"], - "exclude": ["node_modules", "dist"] + "exclude": ["node_modules", "dist"], + "tsc-alias": { + "resolveFullPaths": true + } }