0

I'm failing to deploy to Vercel. I get the error below. Is there anyway that I can get this deployed without downloading the react bundle?

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'),
      },
    },
  },
});
Lauro235
  • 121
  • 1
  • 8
  • 2
    See https://docs.astro.build/en/guides/integrations-guide/preact/#compat. Particularly, the need to add `overrides` for this package to `package.json`. – adsy May 27 '23 at 14:41
  • Thanks for that. I caved in and downloaded react, but I'll go back and see what happens if I uninstall. – Lauro235 May 27 '23 at 17:55

0 Answers0