-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
90 lines (81 loc) · 2.66 KB
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import {defineConfig} from 'vite'
import {viteStaticCopy} from 'vite-plugin-static-copy'
import vue from '@vitejs/plugin-vue'
import react from '@vitejs/plugin-react'
import liveReload from 'vite-plugin-live-reload';
import path from "path";
import AutoImport from 'unplugin-auto-import/vite'
const {ElementPlusResolver} = require("unplugin-vue-components/resolvers");
const Components = require("unplugin-vue-components/vite");
// https://vitejs.dev/config/
//Add All css and js here
//Important: Key must be output filepath without extension, and value will be the file source
const inputs = {
'js/boot': 'src/js/boot.js',
'js/plugin-main-js-file' : 'src/js/main.js',
'js/BmcPublic' : 'src/js/BmcPublic.js',
'js/customizer.js': 'src/js/customizer.js',
'js/BmcFormHandler' : 'src/js/BmcFormHandler.js',
'js/PaymentMethods/paypal-checkout' : 'src/js/PaymentMethods/paypal-checkout.js',
'js/PaymentMethods/stripe-checkout' : 'src/js/PaymentMethods/stripe-checkout.js',
//styles
'css/element' : 'src/scss/admin/app.scss',
'css/customizer' : 'src/scss/admin/customizer.scss',
'css/public-style' : 'src/scss/public/public-style.scss',
'css/BasicTemplate' : 'src/scss/public/BasicTemplate.scss',
//Block Editor assets
'js/Editor/gutenBlock' : 'src/js/Editor/gutenBlock.jsx'
}
export default defineConfig({
plugins:
[
vue(),
react(),
// liveReload([
// `${__dirname}/**/*\.php`,
// ]),
viteStaticCopy({
targets: [
{src: 'src/images', dest: ''},
]
}),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
directives: false
}),
],
build: {
manifest: true,
outDir: 'assets',
//assetsDir: '',
publicDir: 'assets',
//root: '/',
emptyOutDir: true, // delete the contents of the output directory before each build
// https://rollupjs.org/guide/en/#big-list-of-options
rollupOptions: {
input: inputs,
output: {
chunkFileNames: '[name].js',
entryFileNames: '[name].js',
},
},
},
resolve: {
alias: {
'vue': 'vue/dist/vue.esm-bundler.js',
'@': path.resolve(__dirname, 'resources/admin'),
},
},
server: {
port: 2222,
strictPort: true,
hmr: {
port: 2222,
host: 'localhost',
protocol: 'ws',
}
}
})