Skip to content

Commit

Permalink
fix: bundle plus large pour l'instant
Browse files Browse the repository at this point in the history
  • Loading branch information
thom4parisot committed Feb 25, 2025
1 parent cbb4f92 commit 1e203fb
Showing 1 changed file with 35 additions and 36 deletions.
71 changes: 35 additions & 36 deletions front/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,53 @@ import { visualizer } from 'rollup-plugin-visualizer'

// https://vitejs.dev/config/
export default defineConfig(async ({ mode }) => {
const env = loadEnv(mode, fileURLToPath(import.meta.resolve('..')), [
const envPrefix = [
'SNOWPACK_',
'SENTRY_',
])
]

const env = loadEnv(mode, fileURLToPath(import.meta.resolve('..')), envPrefix)
const { SNOWPACK_MATOMO_URL, SNOWPACK_MATOMO_SITE_ID } = env
const isDevelopment = Boolean(mode === 'development' || env.SENTRY_ENVIRONMENT === 'dev')

return {
base: env.DEPLOY_PRIME_URL ?? '/',
envPrefix: 'SNOWPACK_',
envPrefix,
build: {
outDir: 'build',
sourcemap: true,
rollupOptions: {
output: {
manualChunks (id, { getModuleInfo }) {
if (id.match(/\/(@rjsf\/.+|biblatex-csl-converter)\//)) {
return 'metadata'
}
else if (id.match(/\/pagedjs\//)) {
return 'pagedPreview'
}
else if (id.match(/\/(core-js|react|react-.+|redux)\//)) {
return 'react'
}
else if (id.match(/\/(@geist-ui\/core|i18next)\//)) {
return 'ui'
}
else if (id.match(/\/(monaco-editor\/esm\/vs\/editor\/common|yjs|y-.+)/)) {
return 'writerEditorCommon'
}
else if (id.match(/\/monaco-editor\/esm\/vs\/editor/)) {
return 'writerTextEditor'
}
else if (id.match(/\/monaco-editor\/esm\/vs\/(base|common)/)) {
return 'writerBase'
}
// else if (id.match(/\/monaco-editor\/esm\/vs\/base\/browser/)) {
// return 'writerBaseBrowser'
// }
else if (id.match(/\/monaco-editor\/esm\/vs\/(basic-languages|language)\//)) {
return 'writerLanguages'
}
else if (id.match(/\/monaco-editor\/esm\/vs\/platform\//)) {
return 'writerPlatform'
}

return null
manualChunks: {
metadata: [
'biblatex-csl-converter',
'@rjsf/core',
'@rjsf/validator-ajv8'
],
pagedPreview: ['pagedjs'],
react: [
'core-js',
'i18next',
'react',
'react-dom',
'react-dnd',
'react-helmet',
'react-i18next',
'react-redux',
'react-router-dom',
'redux'
],
ui: [
'@geist-ui/core',
'react-feather',
],
textEditor: [
'monaco-editor',
'@monaco-editor/react',
'y-monaco',
'y-websocket',
'yjs'
]
},
},
},
Expand Down

0 comments on commit 1e203fb

Please sign in to comment.