81 lines
2.1 KiB
TypeScript
Executable File
81 lines
2.1 KiB
TypeScript
Executable File
import { defineConfig } from 'vite';
|
|
import vue from '@vitejs/plugin-vue'; // or react from '@vitejs/plugin-react' if using React
|
|
import wasm from 'vite-plugin-wasm';
|
|
import {createHtmlPlugin} from 'vite-plugin-html';
|
|
import typescript from "@rollup/plugin-typescript";
|
|
import fs from 'fs'
|
|
import path from 'path'
|
|
// import pluginTerminal from 'vite-plugin-terminal';
|
|
|
|
export default defineConfig({
|
|
optimizeDeps: {
|
|
include: ['qrcode']
|
|
},
|
|
plugins: [
|
|
vue(), // or react() if using React
|
|
wasm(),
|
|
createHtmlPlugin({
|
|
minify: true,
|
|
template: 'index.html',
|
|
}),
|
|
typescript({
|
|
sourceMap: false,
|
|
declaration: true,
|
|
declarationDir: "dist/types",
|
|
rootDir: "src",
|
|
outDir: "dist",
|
|
}),
|
|
// pluginTerminal({
|
|
// console: 'terminal',
|
|
// output: ['terminal', 'console']
|
|
// })
|
|
],
|
|
build: {
|
|
outDir: 'dist',
|
|
target: 'esnext',
|
|
minify: false,
|
|
rollupOptions: {
|
|
input: './src/router.ts',
|
|
output: {
|
|
entryFileNames: 'index.js',
|
|
},
|
|
},
|
|
lib: {
|
|
entry: path.resolve(__dirname, 'src/router.ts'),
|
|
name: 'ihm-service',
|
|
formats: ['es'],
|
|
fileName: (format) => `ihm-service.${format}.js`,
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': '/src',
|
|
},
|
|
extensions: ['.ts', '.tsx', '.js'],
|
|
},
|
|
server: {
|
|
fs: {
|
|
cachedChecks: false,
|
|
},
|
|
port: 3001,
|
|
proxy: {
|
|
'/storage': {
|
|
target: 'https://demo.4nkweb.com',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
rewrite: (path) => path.replace(/^\/storage/, '/storage'),
|
|
configure: (proxy, _options) => {
|
|
proxy.on('error', (err, _req, _res) => {
|
|
console.log('proxy error', err);
|
|
});
|
|
proxy.on('proxyReq', (proxyReq, req, _res) => {
|
|
console.log('Sending Request:', req.method, req.url);
|
|
});
|
|
proxy.on('proxyRes', (proxyRes, req, _res) => {
|
|
console.log('Received Response:', proxyRes.statusCode, req.url);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
},
|
|
}); |