Bug reproduction.
git clone [email protected]:brillout/vite-3-cjs-bug
cd vite-3-cjs-bug/
pnpm install
pnpm run build
Same as single line (copy-paste me):
git clone [email protected]:brillout/vite-3-cjs-bug && cd vite-3-cjs-bug/ && pnpm install && pnpm run build
Throws:
vite v3.0.0-beta.5 building SSR bundle for production...
โ 56 modules transformed.
'escapeInject' is not exported by node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plugin-ssr/dist/cjs/node/index.js, imported by node_modules/.pnpm/[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/vikepress/src/algolia/DocSearch.ts
file: /home/romuuu/tmp/vite-3-babel-bug/node_modules/.pnpm/[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/vikepress/src/algolia/DocSearch.ts:1:0
1: import { escapeInject } from 'vite-plugin-ssr'
^
2: import { PageContextResolved } from '../config/resolvePageContext'
file:///home/romuuu/tmp/vite-3-babel-bug/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:1858
base = Object.assign(new Error(base.message), base);
^
Error: 'escapeInject' is not exported by node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plugin-ssr/dist/cjs/node/index.js, imported by node_modules/.pnpm/[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/vikepress/src/algolia/DocSearch.ts
The Vite config can be edited at node_modules/vikepress/vite.config.ts
.