First commit
This commit is contained in:
50
vite.config.js
Normal file
50
vite.config.js
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
import path from 'path';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
|
||||
import { createHtmlPlugin } from 'vite-plugin-html';
|
||||
|
||||
process.env.TARGET = process.env.TARGET || 'web';
|
||||
const isCordova = process.env.TARGET === 'cordova';
|
||||
const SRC_DIR = path.resolve(__dirname, './src');
|
||||
const PUBLIC_DIR = path.resolve(__dirname, './public');
|
||||
const BUILD_DIR = path.resolve(
|
||||
__dirname,
|
||||
isCordova ? './cordova/www' : './www',
|
||||
);
|
||||
export default async () => {
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.includes('swiper-') } } }),,
|
||||
createHtmlPlugin({
|
||||
minify: false,
|
||||
inject: {
|
||||
data: {
|
||||
TARGET: process.env.TARGET,
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
root: SRC_DIR,
|
||||
base: '',
|
||||
publicDir: PUBLIC_DIR,
|
||||
build: {
|
||||
outDir: BUILD_DIR,
|
||||
assetsInlineLimit: 0,
|
||||
emptyOutDir: true,
|
||||
rollupOptions: {
|
||||
treeshake: false,
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': SRC_DIR,
|
||||
},
|
||||
},
|
||||
server: {
|
||||
host: true,
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user