Skip to content

Commit

Permalink
perf(platform): exclude TypeScript files from Vite esbuild plugin (#1543
Browse files Browse the repository at this point in the history
)
  • Loading branch information
brandonroberts authored Jan 7, 2025
1 parent cf7c64f commit de85100
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 68 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ tmpanalogapp*

.nx/cache
.nx/workspace-data
vite.config.*.timestamp*
vite.config.*.timestamp*
.vite-inspect
10 changes: 8 additions & 2 deletions apps/analog-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import analog from '@analogjs/platform';
import { visualizer } from 'rollup-plugin-visualizer';
import { defineConfig, Plugin, splitVendorChunkPlugin } from 'vite';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import inspect from 'vite-plugin-inspect';

// Only run in Netlify CI
let base = process.env['URL'] || 'http://localhost:3000';
Expand All @@ -14,7 +15,7 @@ if (process.env['NETLIFY'] === 'true') {
}

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
export default defineConfig(({ mode, isSsrBuild }) => {
return {
root: __dirname,
publicDir: 'src/public',
Expand Down Expand Up @@ -47,7 +48,12 @@ export default defineConfig(({ mode }) => {
}),
nxViteTsPaths(),
visualizer() as Plugin,
splitVendorChunkPlugin(),
// splitVendorChunkPlugin(),
!isSsrBuild &&
inspect({
build: true,
outputDir: '../../.vite-inspect/analog-app',
}),
],
test: {
reporters: ['default'],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
"vfile": "^6.0.3",
"vite": "^5.4.0",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-inspect": "~0.8",
"vite-tsconfig-paths": "4.2.0",
"vitefu": "^0.2.5",
"vitest": "^2.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/platform/src/lib/deps-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function depsPlugin(options?: Options): Plugin[] {
name: 'analogjs-deps-plugin',
config() {
return {
esbuild: { exclude: ['**/*.ts', '**/*.js'] },
ssr: {
noExternal: [
'@analogjs/**',
Expand Down
Loading

0 comments on commit de85100

Please sign in to comment.