feat: vite as build tool
This commit is contained in:
parent
f936386712
commit
00dc3d0fcd
120 changed files with 21298 additions and 15076 deletions
52
new-lamassu-admin/vite.config.js
Normal file
52
new-lamassu-admin/vite.config.js
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import { fileURLToPath } from 'url'
|
||||
|
||||
import { defineConfig, transformWithEsbuild } from 'vite'
|
||||
import react from '@vitejs/plugin-react-swc'
|
||||
import svgr from 'vite-plugin-svgr'
|
||||
import fixReactVirtualized from 'esbuild-plugin-react-virtualized'
|
||||
|
||||
export default defineConfig({
|
||||
base: '/',
|
||||
server: {
|
||||
port: 3001,
|
||||
proxy: {
|
||||
'/graphql': {
|
||||
target: 'https://localhost:8070/graphql',
|
||||
changeOrigin: true,
|
||||
secure: false
|
||||
}
|
||||
}
|
||||
},
|
||||
optimizeDeps: {
|
||||
esbuildOptions: {
|
||||
loader: {
|
||||
'.js': 'jsx',
|
||||
},
|
||||
plugins: [
|
||||
fixReactVirtualized,
|
||||
],
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
{
|
||||
name: 'treat-js-files-as-jsx',
|
||||
async transform (code, id) {
|
||||
if (!id.match(/src\/.*\.js$/)) return null
|
||||
|
||||
// Use the exposed transform from vite, instead of directly
|
||||
// transforming with esbuild
|
||||
return transformWithEsbuild(code, id, {
|
||||
loader: 'jsx',
|
||||
jsx: 'automatic',
|
||||
})
|
||||
},
|
||||
},
|
||||
react(),
|
||||
svgr(),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'src': fileURLToPath(new URL('./src', import.meta.url))
|
||||
},
|
||||
},
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue