0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/packages/experience-legacy/vite.config.ts

58 lines
1.8 KiB
TypeScript
Raw Normal View History

refactor(experience): experience api migration (#6407) * refactor(experience): migrate the password register and sign-in migrate the password register and sign-in flow * fix(experience): update some namings update some namings * refactor(experience): refactor the verification code flow (migration-2) (#6408) * refactor(experience): refactor the verificaiton code flow refactor the verification code flow * refactor(experience): migrate the social and sso flow (migration-3) (#6406) * refactor(experience): migrate the social and sso flow migrate the social and sso flow * refactor(experience): migrate profile fulfillment flow (migration-4) (#6414) * refactor(experience): migrate profile fulfillment flow migrate the profile fulfillment flow * refactor(experience): remove unused hook remove unused hook * fix(experience): fix password policy checker fix password policy checker error display * fix(experience): fix the api name fix the api name * refactor(experience): migrate mfa flow (migration-5) (#6417) * refactor(experience): migrate mfa binding flow migrate mfa binding flow * test(experience): update unit tests (migration-6) (#6420) * test(experience): update unit tests update unit tests * chore(experience): remove legacy APIs remove legacy APIs * refactor(experience): revert api prefix revert api prefix * fix(experience): update the sso connectors endpoint update the sso connectors endpoint * chore: add changeset add changeset * fix(experience): comments fix comments fix * refactor(experience): refactor the code verificatin api refactor the code verification api * refactor(experience): code refactor refactor some implementation logic * feat(experience, core): add experience legacy package (#6527) add experience legacy package
2024-09-08 21:08:52 -05:00
import react from '@vitejs/plugin-react';
import browserslistToEsbuild from 'browserslist-to-esbuild';
import { defineConfig, mergeConfig, type UserConfig } from 'vite';
import viteCompression from 'vite-plugin-compression';
import svgr from 'vite-plugin-svgr';
import { defaultConfig, manualChunks } from '../../vite.shared.config';
const buildConfig = (mode: string): UserConfig => ({
server: {
port: 5001,
hmr: {
port: 6001,
},
},
css: {
modules: {
generateScopedName:
// Keep backward compatibility with the old CSS modules naming in production
mode === 'development' ? '__[hash:base64:5]__[local]' : '[hash:base64:5]_[local]',
},
},
plugins: [
react(),
svgr(),
viteCompression({ disable: mode === 'development' }),
viteCompression({ disable: mode === 'development', algorithm: 'brotliCompress' }),
],
define: {
'import.meta.env.DEV_FEATURES_ENABLED': JSON.stringify(process.env.DEV_FEATURES_ENABLED),
},
build: {
// Use the same browserslist configuration as in README.md.
// Consider using the esbuild target directly in the future.
target: browserslistToEsbuild('> 0.5%, last 2 versions, Firefox ESR, not dead'),
rollupOptions: {
output: {
// Tip: You can use `pnpx vite-bundle-visualizer` to analyze the bundle size
manualChunks: (id, meta) => {
if (/\/node_modules\/i18next[^/]*\//.test(id)) {
return 'i18next';
}
for (const largePackage of ['libphonenumber-js', 'core-js']) {
if (id.includes(`/node_modules/${largePackage}/`)) {
return largePackage;
}
}
return manualChunks(id, meta);
},
},
},
},
});
export default defineConfig(({ mode }) => mergeConfig(defaultConfig, buildConfig(mode)));