-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow tree shaking on design-system, use vite to build output (#33
) * build: move bundler to vite * chore: remove unused rollup deps after moving to vite * refactor: use treeshakeable lodash import * build(vite): add esm and cjs outputs * feat: update target to es6 for better compat * fix(storybook): add empty package.json so it can run with main.js since root package.json is now type: module, .js files are now treated as ESM files... which storybook does not support. See storybookjs/storybook#11587 (comment)
- Loading branch information
Showing
15 changed files
with
2,207 additions
and
1,948 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules | ||
build | ||
dist | ||
build-storybook.log | ||
storybook-static | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "commonjs" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { DateInput as default } from './DateInput' | ||
export * from './DateInput' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"module": "esnext", | ||
"moduleResolution": "node" | ||
}, | ||
"include": ["vite.config.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { defineConfig } from 'vite' | ||
import { resolve } from 'path' | ||
import peerDepsExternal from 'rollup-plugin-peer-deps-external' | ||
import copy from 'rollup-plugin-copy' | ||
import react from '@vitejs/plugin-react' | ||
|
||
export default defineConfig({ | ||
plugins: [react()], | ||
resolve: { | ||
alias: { | ||
'~': resolve(__dirname, './src'), | ||
}, | ||
}, | ||
build: { | ||
lib: { | ||
entry: resolve(__dirname, 'src', 'index.ts'), | ||
name: 'design-system-react', | ||
formats: ['cjs', 'es'], | ||
// for UMD name: 'GlobalName' | ||
}, | ||
rollupOptions: { | ||
plugins: [ | ||
peerDepsExternal(), | ||
copy({ | ||
targets: [{ src: 'src/fonts', dest: 'dist' }], | ||
hook: 'writeBundle', | ||
}), | ||
], | ||
output: [ | ||
{ | ||
dir: 'dist/cjs', | ||
format: 'cjs', | ||
}, | ||
{ | ||
exports: 'named', | ||
dir: 'dist', | ||
preserveModules: true, | ||
preserveModulesRoot: 'src', | ||
format: 'es', | ||
}, | ||
], | ||
}, | ||
target: 'es6', | ||
sourcemap: true, | ||
}, | ||
}) |