Skip to content

Commit

Permalink
chore: improve vite build config
Browse files Browse the repository at this point in the history
  • Loading branch information
oil-oil authored Sep 12, 2023
2 parents b2a2ccb + 7f56a7b commit 279d31a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 32 deletions.
2 changes: 1 addition & 1 deletion packages/docs/devCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function runCommand() {
'start turbo run build --filter=vuesax-ts -- --watch && start vitepress dev docs --port 3000'
} else {
command =
'turborun build --filter=vuesax-ts -- --watch & vitepress dev docs --port 3000'
'turbo run build --filter=vuesax-ts -- --watch & vitepress dev docs --port 3000'
}

execSync(command, { stdio: 'inherit' })
Expand Down
12 changes: 6 additions & 6 deletions packages/vuesax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"description": "vuesax with full vue3 and typescript support",
"version": "0.0.11",
"type": "module",
"main": "dist/lib/index.js",
"module": "dist/es/index.js",
"types": "dist/types/index.d.ts",
"main": "dist/index.umd.cjs",
"module": "dist/index.js",
"exports": {
".": {
"import": "./dist/es/index.js",
"require": "./dist/lib/index.js"
"types": "./dist/src/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.umd.cjs"
},
"./style.css": "./dist/es/style.css"
"./style.css": "./dist/style.css"
},
"files": [
"dist"
Expand Down
32 changes: 7 additions & 25 deletions packages/vuesax/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,22 @@ export default defineConfig({
},
build: {
lib: {
entry: 'src/index.ts'
entry: path.resolve(__dirname, 'src/index.ts'),
name: "vuesax-ts",
fileName: "index"
},
outDir: 'es',
rollupOptions: {
external: ['vue'],
input: {
index: 'src/index.ts',
},
output: [
{
format: 'es',
entryFileNames: '[name].js',
dir: 'dist/es',
preserveModulesRoot: 'src',
exports:"named"
},
{
format: 'cjs',
entryFileNames: '[name].js',
dir: 'dist/lib',
preserveModulesRoot: 'src',
exports:"named"
}
]
}
}
},
plugins: [
vue(),
vueJsx(),
dts({
outputDir: ['dist/lib', 'dist/es'],
tsConfigFilePath: './tsconfig.json',
entryRoot: 'src',
copyDtsFiles: true
})
dts(
{ outputDir: 'dist' }
)
]
})

0 comments on commit 279d31a

Please sign in to comment.