import {defineConfig} from 'vite'; import {hydrogen} from '@shopify/hydrogen/vite'; import {oxygen} from '@shopify/mini-oxygen/vite'; import {sanity} from 'hydrogen-sanity/vite'; import {reactRouter} from '@react-router/dev/vite'; import tsconfigPaths from 'vite-tsconfig-paths'; import tailwindcss from '@tailwindcss/vite'; export default defineConfig({ plugins: [ tailwindcss(), hydrogen(), sanity(), oxygen(), reactRouter(), tsconfigPaths(), ], build: { /** * Production builds on Oxygen don't need sourcemaps by default, and some * dependencies (e.g. `framer-motion`) can emit noisy "Can't resolve original * location" warnings when Vite tries to use sourcemaps to report other errors. */ sourcemap: false, // Allow a strict Content-Security-Policy // without inlining assets as base64: assetsInlineLimit: 0, }, ssr: { noExternal: ['rxjs'], optimizeDeps: { /** * Include dependencies here if they throw CJS<>ESM errors. * For example, for the following error: * * > ReferenceError: module is not defined * > at /Users/.../node_modules/example-dep/index.js:1:1 * * Include 'example-dep' in the array below. * @see https://vitejs.dev/config/dep-optimization-options */ include: [ 'rxjs', 'rxjs/operators', '@sanity/client', 'hydrogen-sanity', 'set-cookie-parser', 'cookie', 'react-router', ], }, }, server: { allowedHosts: ['.tryhydrogen.dev'], }, });