diff --git a/CHANGELOG.md b/CHANGELOG.md index e02468b748..e8414b8ad0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improve controlled Tabs behaviour ([#1050](https://github.com/tailwindlabs/headlessui/pull/1050)) - Improve typeahead search logic ([#1051](https://github.com/tailwindlabs/headlessui/pull/1051)) - Improve overal codebase, use modern tech like `esbuild` and TypeScript 4! ([#1055](https://github.com/tailwindlabs/headlessui/pull/1055)) +- Improve build files ([#1078](https://github.com/tailwindlabs/headlessui/pull/1078)) ### Added @@ -25,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Ensure correct order when conditionally rendering `MenuItem`, `ListboxOption` and `RadioGroupOption` ([#1045](https://github.com/tailwindlabs/headlessui/pull/1045)) - Improve typeahead search logic ([#1051](https://github.com/tailwindlabs/headlessui/pull/1051)) - Improve overal codebase, use modern tech like `esbuild` and TypeScript 4! ([#1055](https://github.com/tailwindlabs/headlessui/pull/1055)) +- Improve build files ([#1078](https://github.com/tailwindlabs/headlessui/pull/1078)) ### Added diff --git a/jest.config.cjs b/jest.config.cjs new file mode 100644 index 0000000000..8333297a4b --- /dev/null +++ b/jest.config.cjs @@ -0,0 +1,3 @@ +module.exports = { + projects: ['/packages/*/jest.config.cjs'], +} diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index 1acc73533d..0000000000 --- a/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - projects: ['/packages/*/jest.config.js'], -} diff --git a/jest/create-jest-config.js b/jest/create-jest-config.cjs similarity index 100% rename from jest/create-jest-config.js rename to jest/create-jest-config.cjs diff --git a/packages/@headlessui-react/build/index.cjs b/packages/@headlessui-react/build/index.cjs new file mode 100644 index 0000000000..92466f4507 --- /dev/null +++ b/packages/@headlessui-react/build/index.cjs @@ -0,0 +1,7 @@ +'use strict' + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./headlessui.prod.cjs') +} else { + module.exports = require('./headlessui.dev.cjs') +} diff --git a/packages/@headlessui-react/build/index.js b/packages/@headlessui-react/build/index.js deleted file mode 100644 index 473f46702e..0000000000 --- a/packages/@headlessui-react/build/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./headlessui.prod.cjs.js') -} else { - module.exports = require('./headlessui.dev.cjs.js') -} diff --git a/packages/@headlessui-react/jest.config.js b/packages/@headlessui-react/jest.config.cjs similarity index 50% rename from packages/@headlessui-react/jest.config.js rename to packages/@headlessui-react/jest.config.cjs index 95fe4bfa1a..8dc6875268 100644 --- a/packages/@headlessui-react/jest.config.js +++ b/packages/@headlessui-react/jest.config.cjs @@ -1,3 +1,2 @@ -const create = require('../../jest/create-jest-config.js') - +let create = require('../../jest/create-jest-config.cjs') module.exports = create(__dirname, { displayName: 'React' }) diff --git a/packages/@headlessui-react/package.json b/packages/@headlessui-react/package.json index 63d805cfe5..ec2c90fc99 100644 --- a/packages/@headlessui-react/package.json +++ b/packages/@headlessui-react/package.json @@ -2,7 +2,7 @@ "name": "@headlessui/react", "version": "1.4.3", "description": "A set of completely unstyled, fully accessible UI components for React, designed to integrate beautifully with Tailwind CSS.", - "main": "dist/index.js", + "main": "dist/index.cjs", "typings": "dist/index.d.ts", "module": "dist/headlessui.esm.js", "license": "MIT", @@ -11,14 +11,11 @@ "dist" ], "exports": { - ".": { - "import": { - "default": "./dist/headlessui.esm.js" - }, - "require": "./dist/index.js", - "types": "./dist/index.d.ts" - } + "import": "./dist/headlessui.esm.js", + "require": "./dist/index.cjs", + "types": "./dist/index.d.ts" }, + "type": "module", "sideEffects": false, "engines": { "node": ">=10" diff --git a/packages/@headlessui-vue/build/index.cjs b/packages/@headlessui-vue/build/index.cjs new file mode 100644 index 0000000000..92466f4507 --- /dev/null +++ b/packages/@headlessui-vue/build/index.cjs @@ -0,0 +1,7 @@ +'use strict' + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./headlessui.prod.cjs') +} else { + module.exports = require('./headlessui.dev.cjs') +} diff --git a/packages/@headlessui-vue/build/index.js b/packages/@headlessui-vue/build/index.js deleted file mode 100644 index 473f46702e..0000000000 --- a/packages/@headlessui-vue/build/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./headlessui.prod.cjs.js') -} else { - module.exports = require('./headlessui.dev.cjs.js') -} diff --git a/packages/@headlessui-vue/jest.config.js b/packages/@headlessui-vue/jest.config.cjs similarity index 50% rename from packages/@headlessui-vue/jest.config.js rename to packages/@headlessui-vue/jest.config.cjs index 4596442e75..7dcc0d44a3 100644 --- a/packages/@headlessui-vue/jest.config.js +++ b/packages/@headlessui-vue/jest.config.cjs @@ -1,3 +1,2 @@ -const create = require('../../jest/create-jest-config.js') - +let create = require('../../jest/create-jest-config.cjs') module.exports = create(__dirname, { displayName: ' Vue ' }) diff --git a/packages/@headlessui-vue/package.json b/packages/@headlessui-vue/package.json index 6d26c210d9..bd83d12ba9 100644 --- a/packages/@headlessui-vue/package.json +++ b/packages/@headlessui-vue/package.json @@ -2,7 +2,7 @@ "name": "@headlessui/vue", "version": "1.4.3", "description": "A set of completely unstyled, fully accessible UI components for Vue 3, designed to integrate beautifully with Tailwind CSS.", - "main": "dist/index.js", + "main": "dist/index.cjs", "typings": "dist/index.d.ts", "module": "dist/headlessui.esm.js", "license": "MIT", @@ -11,14 +11,11 @@ "dist" ], "exports": { - ".": { - "import": { - "default": "./dist/headlessui.esm.js" - }, - "require": "./dist/index.js", - "types": "./dist/index.d.ts" - } + "import": "./dist/headlessui.esm.js", + "require": "./dist/index.cjs", + "types": "./dist/index.d.ts" }, + "type": "module", "sideEffects": false, "engines": { "node": ">=10" diff --git a/packages/playground-vue/src/components/Home.vue b/packages/playground-vue/src/components/Home.vue index cde352323d..3d2f30493e 100644 --- a/packages/playground-vue/src/components/Home.vue +++ b/packages/playground-vue/src/components/Home.vue @@ -1,6 +1,6 @@