fix(core): add vite iife build file
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"prepare": "ts-patch install -s",
|
||||
"build": "vite build",
|
||||
"build": "vite build && vite build -c vite.config.iife.ts",
|
||||
"types": "pnpm prepare && vue-tsc --declaration --emitDeclarationOnly && tsc -p ./tsconfig.build.json && shx rm -rf tmp && pnpm lint:dist && pnpm run patch",
|
||||
"patch": "node patch/slots.js",
|
||||
"theme": "postcss src/style.css -o dist/style.css && postcss src/theme-default.css -o dist/theme-default.css",
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"],
|
||||
"include": ["vite.config.ts", "vite.config.iife.ts"],
|
||||
"files": ["package.json"]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import { resolve } from 'path'
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import VueMacros from 'unplugin-vue-macros/vite'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import replace from '@rollup/plugin-replace'
|
||||
import pkg from './package.json'
|
||||
|
||||
export default defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
'~': resolve('src'),
|
||||
},
|
||||
extensions: ['.ts', '.vue'],
|
||||
},
|
||||
build: {
|
||||
minify: 'esbuild',
|
||||
emptyOutDir: false,
|
||||
lib: {
|
||||
formats: ['iife'],
|
||||
entry: resolve(__dirname, 'src/index.ts'),
|
||||
fileName: 'vue-flow-core',
|
||||
name: 'VueFlowCore',
|
||||
},
|
||||
rollupOptions: {
|
||||
// make sure to externalize deps that shouldn't be bundled
|
||||
// into your library
|
||||
external: ['vue'],
|
||||
output: {
|
||||
format: 'iife',
|
||||
dir: './dist',
|
||||
// Provide global variables to use in the UMD build
|
||||
// for externalized deps
|
||||
globals: {
|
||||
vue: 'Vue',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
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', '@vueuse/core', 'vue/macros'],
|
||||
dirs: ['./src/utils/**', './src/composables/**', './src/context/**', './src/store/**', './src/components/Edges/utils/**'],
|
||||
dts: 'src/auto-imports.d.ts',
|
||||
}),
|
||||
replace({
|
||||
__ENV__: 'production',
|
||||
__VUE_FLOW_VERSION__: JSON.stringify(pkg.version),
|
||||
preventAssignment: true,
|
||||
}),
|
||||
],
|
||||
})
|
||||
@@ -17,10 +17,10 @@ export default defineConfig({
|
||||
minify: 'esbuild',
|
||||
emptyOutDir: false,
|
||||
lib: {
|
||||
formats: ['es', 'cjs', 'iife'],
|
||||
formats: ['es', 'cjs'],
|
||||
entry: resolve(__dirname, 'src/index.ts'),
|
||||
fileName: 'vue-flow-core',
|
||||
name: 'vueFlowCore',
|
||||
name: 'VueFlowCore',
|
||||
},
|
||||
rollupOptions: {
|
||||
// make sure to externalize deps that shouldn't be bundled
|
||||
|
||||
Reference in New Issue
Block a user