Skip to content

Commit 8edc1a9

Browse files
committed
Fix barrel exports
1 parent a5922a6 commit 8edc1a9

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

.changeset/config.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3-
"changelog": "@changesets/cli/changelog",
4-
"commit": false,
5-
"fixed": [],
6-
"linked": [],
7-
"access": "public",
8-
"baseBranch": "main",
9-
"updateInternalDependencies": "patch",
10-
"ignore": []
11-
}
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/rude-jokes-mate.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tokens-studio/icons': patch
3+
---
4+
5+
Allow direct import of icons to decrease reliance on treeshaking

package.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
"author": "[email protected]",
77
"type": "module",
88
"exports": {
9-
".": "./dist/index.js"
9+
"./*": {
10+
"import": "./dist/icons/*",
11+
"types": "./dist/icons/*"
12+
},
13+
".": {
14+
"import": "./dist/index.js",
15+
"types": "./dist/index.d.ts"
16+
}
1017
},
1118
"files": [
1219
"dist"

svgr.config.cjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
const path = require('path');
12
const template = require('./svgr-template.cjs');
23

34
// Custom index template to handle file endings as required
45
function indexTemplate(filePaths) {
56
const exportEntries = filePaths
67
.map(({ path: filePath }) => {
7-
const fileName = filePath.split('/').pop().replace('.tsx', '.js');
8+
const fileName = filePath.split(path.sep).pop().replace('.tsx', '.js');
89
const componentName = fileName.replace('.js', '');
910
return `export { default as ${componentName} } from './${fileName}';`;
1011
})

0 commit comments

Comments
 (0)