Project Context:
I’m implementing a custom Vercel builder (esm with type:module
) for Quasar Framework whit SSR mode.
Current Behavior:
While vercel dev
works correctly during local testing, executing vercel deploy
produces the following ES module error:
Error: Importing "vercel-quasar": require() of ES Module
/vercel/path1/.vercel/builders/node_modules/vercel-quasar/dist/index.js
from /var/task/node_modules/vercel/dist/index.js not supported.
Instead change the require of /vercel/path1/.vercel/builders/node_modules/vercel-quasar/dist/index.js
in /var/task/node_modules/vercel/dist/index.js to a dynamic import()
which is available in all CommonJS modules.
Key Question:
Why does the deployment environment behave differently from the development environment regarding module resolution?
Reproduction Steps:
git clone https://github.com/dongwa/quasar-ssr-vercel-demo
cd quasar-ssr-vercel-demo
pnpm install
vercel dev # Works as expected
vercel deploy # Produces the error
Related Repositories:
- Custom Builder: GitHub - dongwa/vercel-quasar: deploy quasar with ssr mode in vercel
- Test Project: GitHub - dongwa/quasar-ssr-vercel-demo
Additional Details:
- Node.js version: v22.14.0
- vercel version:41.4.1
Would appreciate any insights into resolving this module compatibility issue between development and production environments.