Skip to content

Commit

Permalink
build(frontend): determine minification based on build mode
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Feb 25, 2024
1 parent 328c4d5 commit e81724e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
1 change: 1 addition & 0 deletions docker-compose.development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ services:
args:
APP_VERSION: ${GIT_BRANCH}
VITE_API_URL: https://${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}}
NODE_ENV: development
volumes:
- fmtm_frontend:/frontend
network_mode: none
Expand Down
5 changes: 3 additions & 2 deletions src/frontend/prod.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN pnpm install

ENV NODE_ENV production
ARG NODE_ENV=production
ENV NODE_ENV ${NODE_ENV}
COPY . .
RUN pnpm run build
RUN pnpm run build --mode ${NODE_ENV}



Expand Down
39 changes: 22 additions & 17 deletions src/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,28 @@ import react from '@vitejs/plugin-react';
import { VitePWA } from 'vite-plugin-pwa';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), VitePWA({ registerType: 'autoUpdate' })],
server: {
port: 7051,
host: '0.0.0.0',
watch: {
usePolling: true,
export default defineConfig(({ mode }) => {
return {
plugins: [react(), VitePWA({ registerType: 'autoUpdate' })],
server: {
port: 7051,
host: '0.0.0.0',
watch: {
usePolling: true,
},
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
build: {
minify: mode === 'development' ? false : 'esbuild',
},
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './setupTests.ts',
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './setupTests.ts',
},
};
});

0 comments on commit e81724e

Please sign in to comment.