actionhero / ah-next-plugin

For booting a Next.JS React application inside of Actionhero
5 stars 4 forks source link

Actionhero x Next x ESM #338

Open hahnbeelee opened 2 years ago

hahnbeelee commented 2 years ago

Hi Evan! I'm on a mission to get a next.js app running inside an npm package (which for some reason doesn't work when you do cd node_modules/<package-name> && next dev. After a lot of internet sleuthing I came across a lot of your activity (particularly this issue). Then I eventually ended up looking at grouparoo. Congrats on the acquisition btw! This is a very long-winded intro, for me to ask:

I'm trying to get my next app to run with actionhero. However, my next.js app needs to be in ESM format (much of its dependencies require ESM). When i try following the steps outlined in this readme I get this error:

image

But, when I run npm run dev within my client folder it works fine. I'm curious if actionhero/ah-next-plugin would support esm modules? I'm not sure how everything is working together (whether my next app shouldn't be affected my actionhero etc.) so would love if you could just shine some light on the situation. Thank you!

hahnbeelee commented 2 years ago

Here's my source code

hahnbeelee commented 2 years ago

I tried migrating to ESM (source code above updated) but am receiving this error now: image

evantahler commented 2 years ago

But, when I run npm run dev within my client folder it works fine.

Running OK with dev seems like the behavior I've seen myself - live compiling TS (with ts-node-dev or ts-node) seems to handle ESM imports differently than compiled code 🤷

hahnbeelee commented 2 years ago

Running OK with dev seems like the behavior I've seen myself

@evantahler What do you mean by this? Is there a default dev command I should be using?

Ah gotcha, thanks for the clarification!