aleph.js icon indicating copy to clipboard operation
aleph.js copied to clipboard

Not importing aleph/react breaks the build

Open webpro opened this issue 2 years ago • 0 comments
trafficstars

Steps to reproduce:

deno run -A -r https://alephjs.org/init.ts  # choose "React"
cd my-app
rm routes/_app.tsx routes/_404.tsx routes/todos.tsx
deno task build && deno task start

Everything still fine. Now replace routes/index.tsx with this:

import { useReducer } from 'react';

export default function Main() {
  const [conversation, dispatch] = useReducer(s => s, 1);
  return null;
}
deno task build && deno task start

Find this error in the browser:

Cannot read properties of null (reading 'useReducer')

The issue seems to be that we're no longer importing something from aleph/react, I didn't dig further. As soon as something imports that module we're good again.

Initially I thought the issue was caused by removing _app.tsx, but I think it comes down to the same cause as described above.

webpro avatar Apr 29 '23 07:04 webpro