Skip to content

Latest commit

 

History

History
50 lines (40 loc) · 2 KB

readme.md

File metadata and controls

50 lines (40 loc) · 2 KB

Bug reproduction.

git clone [email protected]:brillout/apollo-vite3-bug
cd apollo-vite3-bug/
pnpm install
pnpm run prod

Same as single line (copy-paste me):

git clone [email protected]:brillout/apollo-vite3-bug && cd apollo-vite3-bug/ && pnpm install && pnpm run prod

Go to localhost:3000 Observe in the terminal:

Server running at http://localhost:3000
file:///home/romuuu/tmp/apollo-vite3-bug/dist/server/assets/_default.page.server.eeb1b5cf.js:6
import { DefaultApolloClient } from "@vue/apollo-composable";
         ^^^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'DefaultApolloClient' not found. The requested module '@vue/apollo-composable' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@vue/apollo-composable';
const { DefaultApolloClient } = pkg;

If we follow the suggested workaround git cherry-pick d49d7 (d49d7) we then get:

# Let's try again
$ pnpm run prod

> vite build

vite v3.0.2 building for production...
✓ 338 modules transformed.
'default' is not exported by node_modules/.pnpm/@[email protected]_evl73agsd2l2vqwzmhm3tuflgi/node_modules/@vue/apollo-composable/dist/index.esm.js, imported by renderer/app.js
file: /home/romuuu/tmp/apollo-vite3-bug/renderer/app.js:5:7
3: import { setPageContext } from './usePageContext'
4: export { createApp }
5: import pkg from '@vue/apollo-composable'
          ^
6: const { DefaultApolloClient } = pkg
error during build:
Error: 'default' is not exported by node_modules/.pnpm/@[email protected]_evl73agsd2l2vqwzmhm3tuflgi/node_modules/@vue/apollo-composable/dist/index.esm.js, imported by renderer/app.js
    at error (file:///home/romuuu/tmp/apollo-vite3-bug/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:1858:30)