menu

ZEIT

Our mission is to make cloud computing as easy and accessible as mobile computing. You can find our Next.js community here.

Channels
Team

Deploying a static site using generator-webapp template

March 22, 2019 at 12:19am

Deploying a static site using generator-webapp template

March 22, 2019 at 12:19am (Edited 3 months ago)

Hello guys, I have tried to deploy a simple yeoman static project without luck using v2.

I thought that @now/static-build could be the answer but I'm not getting the code in the site. Another thing that I need to complish is is the redirect from www to non-www or even the other way.

This is the template that I'm using: https://github.com/yeoman/generator-webapp

This is the now.json file:

{
"name": "project",
"alias": ["www.project.org"],
"version": 2,
"builds": [{ "src": "package.json", "use": "@now/static-build" }],
"routes": [
{
"src": "/(.*)",
"status": 301,
"headers": { "Location": "https://project.org/$1" }
}
]
}

and of course in my package.json I have added:

scripts: {
...
"now-build": "npm run build"
}

and that npm run build will create me a dist folder with all the static necessary content. What I'm doing wrong? I had to use the v1, meanwhile.


March 22, 2019 at 6:51am

This is the Now v2 only method. Redirecting with Now v1 needs to use another method. That sample was here, but it was lost recently: https://github.com/now-examples/

The reaction of the ZEIT member is necessary. Please wait a little more.

like-fill
1
  • reply
  • like