Deployments fail when using Preact
Lauro235 opened this issue · comments
The problem
When deploying an Astro site to Vercel whilst using Preact and Preact/compat, the deployment fails with a note:
Error: Cannot find module 'react'
Require stack:
- /vercel/path0/node_modules/pure-react-carousel/dist/index.cjs.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
at Module._load (node:internal/modules/cjs/loader:920:27)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
The line of code that is presumably causing the deployment problems is this one?
var React=_interopDefault(require("react"))
I'm using Preact and I believe I have the settings set correctly in the Astro config file.
// ...
import preact from '@astrojs/preact';
export default defineConfig({
integrations: [
// ....
preact({ compat: true }),
],
vite: {
resolve: {
alias: {
'~': path.resolve(__dirname, './src'),
},
},
},
});
Describe the feature you'd like:
It would be really amazing if you could provide support for React alternatives like Preact. This allows Developers to keep there dependencies as low as possible.
Suggested implementation:
Unfortunately I wouldn't be able to provide any advice as to how to implement this!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed becuase it has not had recent activity.