feat(tooling): add vite config to tooling pkgs
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
3
tooling/vite-config/.eslintrc.js
Normal file
3
tooling/vite-config/.eslintrc.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
extends: ['@vue-flow/eslint-config'],
|
||||
}
|
||||
17
tooling/vite-config/package.json
Normal file
17
tooling/vite-config/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@vue-flow/vite-config",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"main": "./src/index.js",
|
||||
"types": "./src/index.d.ts",
|
||||
"devDependencies": {
|
||||
"@vue-flow/eslint-config": "workspace:*",
|
||||
"@vue-flow/tsconfig": "workspace:*",
|
||||
"@vitejs/plugin-vue": "^4.0.0",
|
||||
"defu": "^6.1.2",
|
||||
"unplugin-auto-import": "^0.14.4",
|
||||
"vite-plugin-vue-type-imports": "^0.2.4",
|
||||
"vite": "^4.1.4"
|
||||
}
|
||||
}
|
||||
3
tooling/vite-config/src/index.d.ts
vendored
Normal file
3
tooling/vite-config/src/index.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { UserConfig } from 'vite';
|
||||
|
||||
export declare function withConfig(viteConfig: UserConfig): UserConfig;
|
||||
55
tooling/vite-config/src/index.js
Normal file
55
tooling/vite-config/src/index.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const { defu } = require('defu')
|
||||
const vue = require('@vitejs/plugin-vue')
|
||||
const AutoImport = require('unplugin-auto-import/vite')
|
||||
const VueMacros = require('unplugin-vue-macros/vite')
|
||||
|
||||
function withConfig(viteConfig) {
|
||||
return defu(viteConfig, {
|
||||
// https://vitejs.dev/config/
|
||||
resolve: {
|
||||
extensions: ['.ts', '.vue'],
|
||||
},
|
||||
build: {
|
||||
emptyOutDir: false,
|
||||
rollupOptions: {
|
||||
// make sure to externalize deps that shouldn't be bundled
|
||||
// into your library
|
||||
external: ['vue', '@vue-flow/core'],
|
||||
output: {
|
||||
dir: './dist',
|
||||
// Provide global variables to use in the UMD build
|
||||
// for externalized deps
|
||||
globals: {
|
||||
'vue': 'Vue',
|
||||
'@vue-flow/core': 'VueFlow',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
VueMacros({
|
||||
hoistStatic: false,
|
||||
setupBlock: false,
|
||||
shortEmits: false,
|
||||
defineModel: false,
|
||||
definePropsRefs: false,
|
||||
setupComponent: false,
|
||||
setupSFC: false,
|
||||
exportProps: false,
|
||||
plugins: {
|
||||
vue: vue({
|
||||
reactivityTransform: true,
|
||||
}),
|
||||
},
|
||||
}),
|
||||
AutoImport({
|
||||
imports: ['vue', 'vue/macros'],
|
||||
dts: 'src/auto-imports.d.ts',
|
||||
}),
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
withConfig,
|
||||
}
|
||||
19
tooling/vite-config/tsconfig.json
Normal file
19
tooling/vite-config/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"extends": "@vue-flow/tsconfig/base",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"outDir": ".",
|
||||
"emitDeclarationOnly": false,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"isolatedModules": true,
|
||||
"moduleResolution": "node",
|
||||
"preserveWatchOutput": true,
|
||||
"skipLibCheck": true,
|
||||
"noEmit": true,
|
||||
"strict": true
|
||||
},
|
||||
"include": [
|
||||
"./src/*"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user