Skip to content

Commit

Permalink
Organize vite configuration files
Browse files Browse the repository at this point in the history
  • Loading branch information
dash14 committed Aug 17, 2021
1 parent 9c9f8e7 commit 1fc59a4
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 57 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"main": "./lib/index.umd.js",
"module": "./lib/index.es.js",
"scripts": {
"dev": "vite",
"example:dev": "vite --config vite-example.config.ts",
"example:build": "vue-tsc --noEmit && vite build --config vite-example.config.ts",
"example:serve": "vite --config vite-example.config.ts preview",
"build": "run-s clean build:tc build:lib",
"build:tc": "vue-tsc --noEmit",
"build:lib": "run-p build:lib:*",
"build:lib:main": "vite --config vite-lib.config.ts build",
"build:lib:main": "vite build",
"build:lib:force": "vite --config vite-lib-force.config.ts build",
"build:example": "vue-tsc --noEmit && vite build",
"serve": "vite preview",
"clean": "rimraf lib"
},
"dependencies": {
Expand Down
12 changes: 12 additions & 0 deletions vite-example.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
// resolve: {
// alias: [
// { find: '@/', replacement: '/src/' }
// ]
// },
plugins: [vue()]
})
45 changes: 0 additions & 45 deletions vite-lib.config.ts

This file was deleted.

49 changes: 41 additions & 8 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,45 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import dts from "vite-plugin-dts"
import path from "path"

const resolvePath = (str: string) => path.resolve(__dirname, str)

// https://vitejs.dev/config/
export default defineConfig({
// resolve: {
// alias: [
// { find: '@/', replacement: '/src/' }
// ]
// },
plugins: [vue()]
build: {
target: "es2015",
minify: "terser",
lib: {
entry: resolvePath("src/index.ts"),
name: "v-network-graph",
fileName: "index"
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ["vue"],
output: {
exports: "named",
dir: resolvePath("lib"),
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
vue: "Vue",
},
},
},
cssCodeSplit: false,
sourcemap: true,
},
publicDir: false,
plugins: [
vue(),
dts({
compilerOptions: {
rootDir: resolvePath("src")
},
outputDir: resolvePath("lib/types"),
}),
],
})

0 comments on commit 1fc59a4

Please sign in to comment.