Skip to content

Commit abe3e1b

Browse files
authored
Support tree-shaking by enabling preserveModules (#602)
1 parent ece9e87 commit abe3e1b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/@headlessui-react/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
"description": "A set of completely unstyled, fully accessible UI components for React, designed to integrate beautifully with Tailwind CSS.",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",
7-
"module": "dist/headlessui.esm.js",
7+
"module": "dist/index.esm.js",
88
"license": "MIT",
99
"files": [
1010
"README.md",
1111
"dist"
1212
],
13+
"sideEffects": false,
1314
"engines": {
1415
"node": ">=10"
1516
},
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
rollup(config, opts) {
3+
if (opts.format === 'esm') {
4+
config = { ...config, preserveModules: true }
5+
config.output = { ...config.output, dir: 'dist/', entryFileNames: '[name].esm.js' }
6+
delete config.output.file
7+
}
8+
return config
9+
},
10+
}

0 commit comments

Comments
 (0)