Closed justinwhall closed 5 years ago
Thanks for reporting @justinwhall
I've updated the example to use target: serverless
.
Also, npm run dev
should work fine now. Wasn't working before because it was trying to use the assets from S3. The assetPrefix
should only be set in test or prod really.
YA! I did notice the assetPrefix
, even with removing that a route like http://localhost:3000/post/9/
does not work while in dev which is expected as Next doesn't know about that route.
Ah you're right. Right now the best I can think of is using serverless-offline
, which will make the routing work, but then for local development is not great because HMR won't work. Will leave this open and look over the weekend what can be done 👍
^^ Yar! serverless-offline
works great. But no HMR.
Regardless, plugin works great. Brings parody top client/SSR query.foo
. Nice work here.
One solution I can think of is using assetPrefix only in production using phase : https://github.com/zeit/next.js#custom-configuration
One solution I can think of is using assetPrefix only in production using phase : https://github.com/zeit/next.js#custom-configuration
This won't help with HMR during development though?
It shoud ! In dev (next dev), assetPrefix is unset, so next loads the assets as usual and in prod, serverless load the asset generated by the plugin.
Next Config should be
target:serverless
no?Also,
npm run dev
doesn't work really right now. May want to remove that script for now to climate confusion. However... What are you doing for a dev server? Right now, I'm maintaining two different servers essentially.1) Express for local dev 2) lamba/severless for anything but loca.