Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@brandonroberts
Copy link
Member

PR Checklist

Closes #1918

What is the new behavior?

The @analogjs/content package will be excluded from being bundled with the router unless the content highlighter is configured through the analog plugin in the vite.config.ts file. This produces smaller bundle sizes for apps that don't use the markdown content rendering functionality.

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',
  },
}));

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

[optional] What gif best describes this PR or how it makes you feel?

@netlify
Copy link

netlify bot commented Oct 30, 2025

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit e2def6f
🔍 Latest deploy log https://app.netlify.com/projects/analog-docs/deploys/69040654ee91960008e72e84
😎 Deploy Preview https://deploy-preview-1921--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Oct 30, 2025

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit e2def6f
🔍 Latest deploy log https://app.netlify.com/projects/analog-blog/deploys/69040654f955190008510704
😎 Deploy Preview https://deploy-preview-1921--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Oct 30, 2025

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit e2def6f
🔍 Latest deploy log https://app.netlify.com/projects/analog-app/deploys/6904065423972c00089fa195
😎 Deploy Preview https://deploy-preview-1921--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@brandonroberts brandonroberts force-pushed the feat-content-externalize branch from 085c628 to e2def6f Compare October 31, 2025 00:44
@brandonroberts brandonroberts merged commit 119e2b9 into beta Oct 31, 2025
18 checks passed
@brandonroberts brandonroberts deleted the feat-content-externalize branch October 31, 2025 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Externalize @analogjs/content package by default

2 participants