-
-
Notifications
You must be signed in to change notification settings - Fork 298
Closed
Labels
Description
Which scope/s are relevant/related to the feature request?
platform
Information
When building a new Analog application, the @analogjs/content package is bundled and lazy loaded along with the @angular/router even if its not used in the application. This came up in this blog post where the size of the Analog app was being reported as 200kb larger than expected.
This change will externalize the @analogjs/content package by default, and include it when configured. This will report the final bundle sizes correctly for applications that do not use the content package.
BEFORE:
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import analog from '@analogjs/platform';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
build: {
target: ['es2020'],
},
resolve: {
mainFields: ['module'],
},
plugins: [
analog(), // package is excluded from the build
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['src/test-setup.ts'],
include: ['**/*.spec.ts'],
reporters: ['default'],
},
define: {
'import.meta.vitest': mode !== 'production',
},
}));AFTER:
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import analog from '@analogjs/platform';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
build: {
target: ['es2020'],
},
resolve: {
mainFields: ['module'],
},
plugins: [
analog({
content: {
highlighter: 'shiki' // includes the package in the bundle
}
}),
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['src/test-setup.ts'],
include: ['**/*.spec.ts'],
reporters: ['default'],
},
define: {
'import.meta.vitest': mode !== 'production',
},
}));Describe any alternatives/workarounds you're currently using
No response
I would be willing to submit a PR to fix this issue
- Yes
- No