11import { sentryTanstackStart } from '@sentry/tanstackstart-react/vite'
22import { defineConfig } from 'vite'
3- import type { PluginOption } from 'vite'
43import { redact } from '@tanstack/redact/vite'
54import contentCollections from '@content-collections/vite'
65import { devtools as tanstackDevtools } from '@tanstack/devtools-vite'
@@ -10,16 +9,10 @@ import { cloudflare } from '@cloudflare/vite-plugin'
109import { analyzer } from 'vite-bundle-analyzer'
1110import viteReact from '@vitejs/plugin-react'
1211import fs from 'node:fs'
13- import { createRequire } from 'node:module'
1412import os from 'node:os'
1513import path from 'node:path'
1614
17- const nodeRequire = createRequire ( import . meta. url )
1815const isDev = process . env . NODE_ENV !== 'production'
19- const takumiWasmRuntimePath = path . join (
20- path . dirname ( path . dirname ( nodeRequire . resolve ( '@takumi-rs/wasm/no-bundler' ) ) ) ,
21- 'bundlers/workerd.js' ,
22- )
2316const shouldUseRedact = process . env . DISABLE_REDACT !== 'true'
2417const localRedactPackageRoot = process . env . LOCAL_REDACT_PACKAGE_ROOT
2518const shouldUseSentryPlugin =
@@ -37,21 +30,6 @@ const envDir =
3730 ? defaultCheckoutEnvDir
3831 : __dirname
3932
40- function edgeTakumiWasmImport ( ) : PluginOption {
41- return {
42- name : 'tanstack-edge-takumi-wasm-import' ,
43- enforce : 'pre' ,
44- transform ( code , id ) {
45- if ( ! id . includes ( '/node_modules/takumi-js/dist/render-' ) ) return
46-
47- return code . replace (
48- / i m p o r t \( \s * \/ \* \s * @ v i t e - i g n o r e \s * \* \/ \s * [ ' " ] @ t a k u m i - r s \/ w a s m [ ' " ] \s * \) / g,
49- 'import("@takumi-rs/wasm/no-bundler")' ,
50- )
51- } ,
52- }
53- }
54-
5533// Runtime-specific `react-dom/server` variants aren't in @tanstack/redact/vite's
5634// default alias map. Funnel them all to `@tanstack/redact/server` at the
5735// top-level resolve so Workers get a single server implementation.
@@ -122,10 +100,6 @@ export default defineConfig({
122100 find : 'unicorn-magic' ,
123101 replacement : 'unicorn-magic/node' ,
124102 } ,
125- {
126- find : '@takumi-rs/wasm/auto' ,
127- replacement : takumiWasmRuntimePath ,
128- } ,
129103 ...( shouldUseRedact
130104 ? [
131105 useSyncExternalStoreShimIndexAlias ,
@@ -181,11 +155,6 @@ export default defineConfig({
181155 // CTA packages use execa which has a broken unicorn-magic dependency
182156 '@tanstack/create' ,
183157 'discord-interactions' ,
184- // OG image generation: takumi ships a native .node binary
185- '@takumi-rs/core' ,
186- '@takumi-rs/image-response' ,
187- '@takumi-rs/helpers' ,
188- 'takumi-js' ,
189158 // Don't pre-bundle CLI so we always get fresh changes during dev
190159 ...( isDev ? [ '@tanstack/cli' ] : [ ] ) ,
191160 // Lucide can resolve differently across Vite environments when combined
@@ -249,7 +218,6 @@ export default defineConfig({
249218 } ,
250219 } ,
251220 plugins : [
252- edgeTakumiWasmImport ( ) ,
253221 cloudflare ( {
254222 viteEnvironment : { name : 'ssr' } ,
255223 } ) ,
0 commit comments