cb5adfe031
* fix: swap error caused by invalid id and batchcount * fix: enhance creation messages for admin drive and user drives * fix: identity and wallet creation * fix: asset preview types * fix: fm search unicode text * fix: feed identity and stamp usage * fix: ui display changes * fix: stamp buy and dilute * fix: vite polyfill warning for stream * fix: standard mode postage stamp purchase reserves incorrect size and duration * fix: add syncing message for Bee node and update page state handling * refactor: stamp depth and amount validation --------- Co-authored-by: Balint Ujvari <balint.ujvari@solarpunk.buzz> Co-authored-by: Bálint Ujvári <58116288+bosi95@users.noreply.github.com> Co-authored-by: rolandlor <33499567+rolandlor@users.noreply.github.com>
110 lines
3.0 KiB
TypeScript
110 lines
3.0 KiB
TypeScript
import path from 'path'
|
|
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import dts from 'vite-plugin-dts'
|
|
import { nodePolyfills } from 'vite-plugin-node-polyfills'
|
|
|
|
const DEFAULT_VITE_DEV_PORT = 3002
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const isProd = mode === 'production'
|
|
const isComponentBuild = process.env.BUILD_MODE === 'component'
|
|
|
|
if (isComponentBuild) {
|
|
return {
|
|
build: {
|
|
lib: {
|
|
entry: path.resolve(__dirname, 'src/App.tsx'),
|
|
name: 'beeDashboard',
|
|
fileName: format => `App.${format === 'es' ? 'js' : 'cjs.js'}`,
|
|
formats: ['es', 'cjs'],
|
|
},
|
|
sourcemap: !isProd,
|
|
minify: false,
|
|
outDir: 'lib',
|
|
rollupOptions: {
|
|
external: ['react', 'react-dom'],
|
|
output: {
|
|
globals: {
|
|
react: 'React',
|
|
'react-dom': 'ReactDOM',
|
|
},
|
|
assetFileNames: (assetInfo: any) => {
|
|
if (assetInfo.originalFileNames?.includes('style.css') || assetInfo.names?.includes('bee-dashboard.css'))
|
|
return 'App.css'
|
|
return assetInfo.names?.[0] || 'asset'
|
|
},
|
|
},
|
|
},
|
|
},
|
|
plugins: [
|
|
react(),
|
|
dts({
|
|
exclude: ['**/tests/**', 'src/index.tsx'],
|
|
outDir: 'lib',
|
|
entryRoot: 'src',
|
|
tsconfigPath: './tsconfig.lib.json',
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src'),
|
|
},
|
|
extensions: ['.ts', '.tsx', '.js', '.jsx', '.css', '.scss'],
|
|
},
|
|
}
|
|
}
|
|
|
|
return {
|
|
plugins: [
|
|
react(),
|
|
nodePolyfills({
|
|
include: ['util', 'buffer', 'stream'],
|
|
globals: {
|
|
Buffer: true,
|
|
global: true,
|
|
process: true,
|
|
},
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src'),
|
|
},
|
|
extensions: ['.ts', '.tsx', '.js', '.jsx', '.css', '.scss'],
|
|
},
|
|
optimizeDeps: {
|
|
// include: [],
|
|
// exclude: [], // add libs for local development, if needed, e.g.: @solarpunkltd/file-manager-lib
|
|
},
|
|
build: {
|
|
outDir: 'build',
|
|
sourcemap: !isProd,
|
|
commonjsOptions: {
|
|
transformMixedEsModules: true,
|
|
},
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id) {
|
|
if (id.includes('node_modules')) {
|
|
if (id.includes('react') || id.includes('react-dom') || id.includes('@mui') || id.includes('@emotion'))
|
|
return 'vendor-react-mui'
|
|
if (id.includes('ethers') || id.includes('@ethersproject')) return 'vendor-ethers'
|
|
if (id.includes('@ethersphere/bee-js')) return 'vendor-bee-js'
|
|
if (id.includes('notistack')) return 'vendor-notistack'
|
|
|
|
// let Vite handle the rest
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
port: DEFAULT_VITE_DEV_PORT,
|
|
open: true,
|
|
},
|
|
publicDir: 'public',
|
|
assetsInclude: ['**/*.svg'],
|
|
}
|
|
})
|