Skip to content

Commit

Permalink
Fix tree-shaking of Circuit UI (#2185)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer committed Jul 15, 2023
1 parent 4b7dd4d commit cf5e82f
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-plums-draw.md
@@ -0,0 +1,5 @@
---
'@sumup/circuit-ui': patch
---

Fixed tree-shaking by retaining the original file structure in the build output.
87 changes: 70 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/circuit-ui/package.json
Expand Up @@ -64,7 +64,8 @@
"react-swipeable": "^7.0.0",
"typescript": "^5.0.4",
"typescript-plugin-css-modules": "^5.0.1",
"vite": "^4.3.4"
"vite": "^4.3.4",
"vite-plugin-no-bundle": "^2.0.2"
},
"peerDependencies": {
"@emotion/is-prop-valid": "1.x",
Expand Down
6 changes: 6 additions & 0 deletions packages/circuit-ui/vite.config.ts
Expand Up @@ -17,6 +17,7 @@ import crypto from 'node:crypto';
import path from 'node:path';

import { UserConfig, defineConfig } from 'vite';
import noBundlePlugin from 'vite-plugin-no-bundle';

import {
dependencies,
Expand Down Expand Up @@ -79,6 +80,11 @@ export default defineConfig({
],
},
},
plugins: [
// @ts-expect-error vite-plugin-no-bundle is bundled in a non-standard way.
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
(noBundlePlugin.default || noBundlePlugin)({ root: './' }),
],
test: {
globals: true,
environment: 'jsdom',
Expand Down

0 comments on commit cf5e82f

Please sign in to comment.