Skip to content

Commit

Permalink
feat: Individual imports (#162)
Browse files Browse the repository at this point in the history
* init

* build individual components

* remove dist from eslint
  • Loading branch information
imprashast committed Apr 22, 2024
1 parent 7463cce commit 42c72d5
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 3 deletions.
20 changes: 19 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,25 @@
"type": "module",
"exports": {
".": "./dist/warp-vue.js",
"./docs": "./dist/docs/warp-vue.js"
"./docs": "./dist/docs/warp-vue.js",
"./alert": "./dist/alert.js",
"./attention": "./dist/attention.js",
"./badge": "./dist/badge.js",
"./box": "./dist/box.js",
"./breadcrumbs": "./dist/breadcrumbs.js",
"./button-group": "./dist/button-group.js",
"./button": "./dist/button.js",
"./card": "./dist/card.js",
"./expandable": "./dist/expandable.js",
"./forms": "./dist/forms.js",
"./generic": "./dist/generic.js",
"./modal": "./dist/modal.js",
"./pill": "./dist/pill.js",
"./slider": "./dist/slider.js",
"./steps": "./dist/steps.js",
"./switch": "./dist/switch.js",
"./tabs": "./dist/tabs.js",
"./tag": "./dist/tag.js"
},
"imports": {
"#util": "./components/util/index.js",
Expand Down
36 changes: 34 additions & 2 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,40 @@ function getBuildOpts(env) {
if (env.mode === 'lib') {
return defineConfig({
build: {
...getLibOpts('warp-vue'),
rollupOptions: { external: ['vue'] },
lib: {
entry: {
tag: 'components/tag/index.js',
tabs: 'components/tabs/index.js',
switch: 'components/switch/index.js',
steps: 'components/steps/index.js',
slider: 'components/slider/index.js',
pill: 'components/pill/index.js',
modal: 'components/modal/index.js',
generic: 'components/generic/index.js',
forms: 'components/forms/index.js',
expandable: 'components/expandable/index.js',
card: 'components/card/index.js',
'button-group': 'components/button-group/index.js',
button: 'components/button/index.js',
breadcrumbs: 'components/breadcrumbs/index.js',
box: 'components/box/index.js',
badge: 'components/badge/index.js',
attention: 'components/attention/index.js',
alert: 'components/alert/index.js',
'warp-vue': './index.js',
},
formats: ['es'],
},
rollupOptions: {
external: ['vue'],
output: {
format: 'es',
dir: 'dist/',
entryFileNames: '[name].js',
assetFileNames: 'assets/[name].[ext]',
chunkFileNames: '[name].js',
},
},
},
});
}
Expand Down

0 comments on commit 42c72d5

Please sign in to comment.