Skip to content
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

Feature: update build directory if preset is Vercel #491

Closed
2 tasks
brandonroberts opened this issue Jun 30, 2023 · 1 comment · Fixed by #525
Closed
2 tasks

Feature: update build directory if preset is Vercel #491

brandonroberts opened this issue Jun 30, 2023 · 1 comment · Fixed by #525
Assignees
Labels
enhancement New feature or request

Comments

@brandonroberts
Copy link
Member

brandonroberts commented Jun 30, 2023

Which scope/s are relevant/related to the feature request?

vite-plugin-nitro

Information

Analog supports deploying to Vercel through a client-only app or SSR app deployed as a Vercel function.

If you want to deploy a fullstack app, you need to adjust the output directory to use Vercel's Build Output API, which is located in the .vercel directory at the root of the workspace.

Here's an example repo https://github.com/brandonroberts/analog-angular-vercel-example

We should adjust the output directory internally if the deployment provider is Vercel so it can be a low config deployment

Describe any alternatives/workarounds you're currently using

Adjust the build output in the Vite config

/// <reference types="vitest" />

import analog from '@analogjs/platform';
import { defineConfig, splitVendorChunkPlugin } from 'vite';
import tsConfigPaths from 'vite-tsconfig-paths';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
  return {
    publicDir: 'src/public',
    optimizeDeps: {
      include: ['@angular/common', '@angular/forms'],
    },
    build: {
      target: ['es2020'],
    },
    plugins: [
      analog({
        nitro: {
          output: {
            dir: '../../../.vercel/output', // <- Vercel output
            publicDir: '../../../.vercel/output/static', // <- Vercel output
          },
        },
      }),
      tsConfigPaths({
        root: '../',
      }),
      splitVendorChunkPlugin(),
    ],
    test: {
      globals: true,
      environment: 'jsdom',
      setupFiles: ['src/test-setup.ts'],
      include: ['**/*.spec.ts'],
      cache: {
        dir: `../node_modules/.vitest`,
      },
    },
    define: {
      'import.meta.vitest': mode !== 'production',
    },
  };
});

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@brandonroberts brandonroberts added the enhancement New feature or request label Jun 30, 2023
@goetzrobin
Copy link
Member

@brandonroberts I can work on this 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants