Skip to content

Commit

Permalink
fix: Build on Netlify
Browse files Browse the repository at this point in the history
  • Loading branch information
acasazza committed Mar 19, 2021
1 parent ca9a044 commit 4d08fd8
Show file tree
Hide file tree
Showing 10 changed files with 164 additions and 186 deletions.
1 change: 0 additions & 1 deletion template/web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ SANITY_STUDIO_API_DATASET=production
# ----- Sanity ------
SANITY_PROJECT_ID="your_project_id"
SANITY_DATASET=production
SANITY_TOKEN="your_token"

# ----- Demo settings ------
BUILD_LANGUAGES=en-US,it-IT
Expand Down
16 changes: 10 additions & 6 deletions template/web/netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
base = "web"
publish = "/out"
command = "npm run build"

[[plugins]]
package = "@netlify/plugin-nextjs"
functions = "/netlify"

[context.production.environment]
[build.environment]
NEXT_SERVERLESS = "true"
NODE_ENV = "production"
SANITY_PROJECT_ID="wvv7gbzb"
SANITY_DATASET="production"
SANITY_TOKEN = "skrAN9uZOkm56VmrMvbx8VGHHIVafUCQPFjUF5SpRQwqjs1JUbDlpCQ6VkSZYsN0Sb4Q2rraGt3WpaTsR8Ky1srtxEWGnQjePRTbuInIIHy0MOTFSrQQt5bhS1JwTgGgPdnrKkimjsqisvgRCj9dk9MEPy67BFcuAl1AomM6qYSLDLpVRGVe"
BUILD_LANGUAGES = "en-US,it-IT"
BUILD_CMS = "sanity"
CL_CLIENT_ID = "ETpqt0R5oIDG8BgttE4idgGMkR6PeOkBCNnRhp-nvGk"
CL_ENDPOINT = "https://demo.commercelayer.io"

[[plugins]]
package = "@netlify/plugin-nextjs"

[[plugins]]
package = "netlify-plugin-inline-functions-env"
[plugins.inputs]
buildEvent = "onBuild"
16 changes: 7 additions & 9 deletions template/web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
const STUDIO_REWRITE = {
source: '/studio/:path*',
destination:
process.env.NODE_ENV === 'development'
? 'http://localhost:3333/studio/:path*'
: '/studio/index.html',
}

module.exports = {
target: 'serverless',
env: {
JSCOV: 0,
SANITY_PROJECT_ID: process.env.SANITY_PROJECT_ID,
SANITY_DATASET: process.env.SANITY_DATASET,
SANITY_TOKEN: process.env.SANITY_TOKEN,
BUILD_LANGUAGES: process.env.BUILD_LANGUAGES,
BUILD_CMS: process.env.BUILD_CMS,
CL_CLIENT_ID: process.env.CL_CLIENT_ID,
CL_ENDPOINT: process.env.CL_ENDPOINT,
},
rewrites: () => [STUDIO_REWRITE],
}
Loading

0 comments on commit 4d08fd8

Please sign in to comment.