+
Skip to content

fix(vite-plugin-nitro): disable internal autoImports by default #1665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 1, 2025

Conversation

brandonroberts
Copy link
Member

@brandonroberts brandonroberts commented Apr 1, 2025

PR Checklist

Closes #

What is the new behavior?

The internal autoImports flag is disabled, as we do not expose auto-imports by default. This also helps with compatibility when using Rolldown with Vite.

To enable manually:

/// <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({
      nitro: {
        imports: {
          autoImport: true
        },        
      }
    })
  ],
  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?

Copy link

netlify bot commented Apr 1, 2025

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit 468afe2
🔍 Latest deploy log https://app.netlify.com/sites/analog-app/deploys/67ebe2eda2363a0008fd8b82
😎 Deploy Preview https://deploy-preview-1665--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 site configuration.

Copy link

netlify bot commented Apr 1, 2025

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit 468afe2
🔍 Latest deploy log https://app.netlify.com/sites/analog-docs/deploys/67ebe2edff14d70008b9d805
😎 Deploy Preview https://deploy-preview-1665--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 site configuration.

Copy link

netlify bot commented Apr 1, 2025

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit 468afe2
🔍 Latest deploy log https://app.netlify.com/sites/analog-blog/deploys/67ebe2ede126890008a7d8a8
😎 Deploy Preview https://deploy-preview-1665--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 site configuration.

Copy link

netlify bot commented Apr 1, 2025

Deploy Preview for analog-ng-app ready!

Name Link
🔨 Latest commit 468afe2
🔍 Latest deploy log https://app.netlify.com/sites/analog-ng-app/deploys/67ebe2ed5716e4000852fe2f
😎 Deploy Preview https://deploy-preview-1665--analog-ng-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 site configuration.

@brandonroberts brandonroberts merged commit 1d09c74 into beta Apr 1, 2025
22 checks passed
@brandonroberts brandonroberts deleted the fix-nitro-auto-imports branch April 1, 2025 13:09
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.

1 participant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载