webapp/app.config.ts

77 lines
2.1 KiB
TypeScript
Raw Normal View History

2024-06-24 17:50:27 +00:00
import { SolidStartInlineConfig, defineConfig } from '@solidjs/start/config'
2024-07-13 16:29:17 +00:00
import { CSSOptions } from 'vite'
2024-07-13 07:44:51 +00:00
// import { visualizer } from 'rollup-plugin-visualizer'
2024-07-13 07:01:41 +00:00
import mkcert from 'vite-plugin-mkcert'
2024-07-13 16:29:17 +00:00
import { PolyfillOptions, nodePolyfills } from 'vite-plugin-node-polyfills'
2024-06-24 17:50:27 +00:00
import sassDts from 'vite-plugin-sass-dts'
const isVercel = Boolean(process?.env.VERCEL)
2024-08-11 22:21:01 +00:00
const isNetlify = Boolean(process?.env.NETLIFY)
2024-06-25 14:22:28 +00:00
const isBun = Boolean(process.env.BUN)
2024-08-12 11:42:31 +00:00
const runtime = isNetlify ? 'netlify' : isVercel ? 'vercel_edge' : isBun ? 'bun' : 'node'
2024-08-11 22:21:01 +00:00
console.info(`[app.config] build for ${runtime}!`)
2024-07-18 09:22:28 +00:00
2024-07-13 16:29:17 +00:00
const polyfillOptions = {
include: ['path', 'stream', 'util'],
exclude: ['http'],
globals: {
Buffer: true
},
overrides: {
fs: 'memfs'
},
protocolImports: true
} as PolyfillOptions
2024-06-28 07:47:38 +00:00
2024-06-24 17:50:27 +00:00
export default defineConfig({
2024-08-14 12:50:01 +00:00
nitro: {
timing: true
},
2024-06-25 22:52:46 +00:00
ssr: true,
2024-06-24 17:50:27 +00:00
server: {
2024-08-11 22:21:01 +00:00
preset: runtime,
port: 3000,
2024-07-13 17:15:41 +00:00
https: true
2024-06-24 17:50:27 +00:00
},
2024-06-25 22:52:46 +00:00
devOverlay: true,
2024-06-24 17:50:27 +00:00
vite: {
2024-09-03 16:19:24 +00:00
build: {
rollupOptions: {
output: {
manualChunks: {
'icons': ['./src/components/_shared/Icon/Icon.tsx'],
'localize': ['./src/context/localize.tsx']
}
}
}
},
2024-06-24 17:50:27 +00:00
envPrefix: 'PUBLIC_',
2024-07-15 14:28:08 +00:00
plugins: [!isVercel && mkcert(), nodePolyfills(polyfillOptions), sassDts()],
2024-06-24 17:50:27 +00:00
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "src/styles/imports";\n',
2024-06-26 08:22:05 +00:00
includePaths: ['./public', './src/styles']
}
2024-07-15 14:28:08 +00:00
} as CSSOptions['preprocessorOptions']
2024-09-03 15:37:57 +00:00
},
build: {
chunkSizeWarningLimit: 800,
target: 'esnext',
sourcemap: true,
rollupOptions: {
// plugins: [visualizer()]
output: {
manualChunks: {
'icons': ['./src/components/_shared/Icon/Icon.tsx'],
'session': ['./src/context/session.tsx'],
'editor': ['./src/context/editor.tsx'],
'localize': ['./src/context/localize.tsx'],
'connect': ['./src/context/connect.tsx']
}
}
}
2024-06-24 17:50:27 +00:00
}
}
} as SolidStartInlineConfig)