Skip to content

Instantly share code, notes, and snippets.

@twenty
Last active June 19, 2020 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twenty/d226825f0aa2c6ea06d686a1ea460a2d to your computer and use it in GitHub Desktop.
Save twenty/d226825f0aa2c6ea06d686a1ea460a2d to your computer and use it in GitHub Desktop.
Frontity Now Deployment
{
"version": 2,
"builds": [
{
"src": "build/static/**/*",
"use": "@now/static"
},
{
"src": "robots.txt",
"use": "@now/static"
},
{
"src": "favicon.ico",
"use": "@now/static"
},
{
"src": "build/server.js",
"use": "@now/node"
},
{
"src": "package.json",
"use": "@now/node-server"
}
],
"routes": [
{
"src": "/robots.txt",
"dest": "/robots.txt"
},
{
"src": "/static/(.*)",
"dest": "/build/static/$1"
},
{
"src": "/(.*)",
"dest": "/build/server.js"
}
]
}
{
"name": "example",
"version": "1.0.0",
"private": true,
"description": "Frontity project",
"keywords": [
"frontity"
],
"engines": {
"node": "12.x"
},
"scripts": {
"main": "server.js",
"start": "node build/server.js",
"dev": "frontity dev --dont-open-browser",
"build": "frontity build",
"serve": "frontity serve",
"deploy": "npx frontity build && npx now --prod",
"postInstall": "npm install --no-save --no-optional fabric@^1.6.7"
},
"prettier": {},
"dependencies": {
"@frontity/core": "^1.4.1",
"@frontity/html2react": "^1.1.15",
"@frontity/mars-theme": "./packages/mars-theme",
"@frontity/tiny-router": "^1.0.18",
"@frontity/wp-source": "^1.4.3",
"@frontity/yoast": "^1.1.6",
"animate.css": "^3.7.2",
"bootstrap": "^4.4.1",
"canvas": "^2.6.1",
"formik": "^2.1.2",
"frontity": "^1.4.4",
"jsdom": "^15.2.1",
"react-bootstrap": "^1.0.0-beta.16",
"react-ga": "^2.7.0",
"react-hotjar": "^2.0.4",
"react-images": "^1.1.0-beta.1",
"react-places-autocomplete": "^7.2.1",
"react-select": "^3.0.8",
"react-stripe-elements": "^6.0.1",
"react-transition-group": "^4.4.1",
"react-typed": "^1.2.0",
"react-wow": "^1.0.0",
"xmldom": "^0.2.1"
}
}
@cbfn
Copy link

cbfn commented Feb 10, 2020

Hello! I'm doing something similar but I'm having problem to deploy it. Because my build directory is in gitignore, also I think that they are inherited from .nowignore. Have you commited your build directory? Do you have a server.js file in root directory?

@twenty
Copy link
Author

twenty commented Feb 11, 2020

Hello! I'm doing something similar but I'm having problem to deploy it. Because my build directory is in gitignore, also I think that they are inherited from .nowignore. Have you commited your build directory? Do you have a server.js file in root directory?

It's a private repository, but no build directory isn't committed. I'll need to check tomorrow about the server.js file, but I believe it's within the build dir.

@twenty
Copy link
Author

twenty commented Feb 11, 2020

Screen Shot 2020-02-12 at 9 53 14 am

This is my build directory in Now.

@cbfn
Copy link

cbfn commented Feb 12, 2020

Your build directory is in .gitignore?

@twenty
Copy link
Author

twenty commented Feb 13, 2020

Yep, this is my .gitignore:
.gcloudignore /build/* node_modules/*

@twenty
Copy link
Author

twenty commented Feb 29, 2020

@cbfn For what it's worth, I've just come across the same issue you mentioned (no server.js or assets folder within build directory).

In my case it ended up being due to an error being thrown (but not actually displayed in the build process) within packages/<theme_name>/components/index.js. For me it was attempting to load .OTF font files but no handler was registered with webpack.

This was a trial & error processing, removing imports/code within my index.js file until it would build and working backwards from there. Would be nice if Frontity displayed said errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment