From ed410051e2bbf85c1dd1e71e63faaf7487fc75fc Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 18 Mar 2024 11:37:44 -0400 Subject: [PATCH] ci: add vite-plugin-node-polyfills plugin --- package.json | 1 + vite.config.ts | 46 ++++++++++++++++++++++++---------------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index b4e6d3c..be3251c 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "tailwindcss": "^3.4.1", "typescript": "^5.1.6", "vite": "^5.1.0", + "vite-plugin-node-polyfills": "^0.21.0", "vite-tsconfig-paths": "^4.2.1" }, "engines": { diff --git a/vite.config.ts b/vite.config.ts index 09fba71..b44af8e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,27 +1,29 @@ -import { vitePlugin as remix } from "@remix-run/dev" -import { defineConfig } from "vite" +import {vitePlugin as remix} from "@remix-run/dev" +import {defineConfig} from "vite" import tsconfigPaths from "vite-tsconfig-paths" +import {nodePolyfills} from 'vite-plugin-node-polyfills' export default defineConfig({ - plugins: [ - remix({ - ssr: false, - ignoredRouteFiles: ["**/*.css"] - }), - tsconfigPaths() - ], - server: { - fs: { - // Restrict files that could be served by Vite's dev server. Accessing - // files outside this directory list that aren't imported from an allowed - // file will result in a 403. Both directories and files can be provided. - // If you're comfortable with Vite's dev server making any file within the - // project root available, you can remove this option. See more: - // https://vitejs.dev/config/server-options.html#server-fs-allow - allow: [ - "app", - "node_modules/@fontsource-variable/manrope", - ] + plugins: [ + remix({ + ssr: false, + ignoredRouteFiles: ["**/*.css"] + }), + tsconfigPaths(), + nodePolyfills(), + ], + server: { + fs: { + // Restrict files that could be served by Vite's dev server. Accessing + // files outside this directory list that aren't imported from an allowed + // file will result in a 403. Both directories and files can be provided. + // If you're comfortable with Vite's dev server making any file within the + // project root available, you can remove this option. See more: + // https://vitejs.dev/config/server-options.html#server-fs-allow + allow: [ + "app", + "node_modules/@fontsource-variable/manrope", + ] + } } - } })