Skip to content
This repository has been archived by the owner on Jan 28, 2025. It is now read-only.

Example should be target: severless #15

Closed
justinwhall opened this issue Mar 20, 2019 · 8 comments
Closed

Example should be target: severless #15

justinwhall opened this issue Mar 20, 2019 · 8 comments

Comments

@justinwhall
Copy link

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.
@danielcondemarin
Copy link
Contributor

danielcondemarin commented Mar 20, 2019

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.

@justinwhall
Copy link
Author

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.

@danielcondemarin
Copy link
Contributor

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 👍

@justinwhall
Copy link
Author

^^ Yar! serverless-offline works great. But no HMR.

Regardless, plugin works great. Brings parody top client/SSR query.foo. Nice work here.

@romainquellec
Copy link

One solution I can think of is using assetPrefix only in production using phase : https://github.com/zeit/next.js#custom-configuration

@justinwhall
Copy link
Author

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?

@romainquellec
Copy link

romainquellec commented Mar 22, 2019

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.

@danielcondemarin
Copy link
Contributor

Duplicate of: #59

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants