Skip to content

Commit

Permalink
Improve Vercel build (#1656)
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm authored Sep 15, 2021
1 parent 952f6dc commit 36cb41b
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/build/
.cache/
.next/
build/
coverage/
dist/
fixtures/
node_modules/
public/
*.min.*
/build/
*.md
*.mdx
1 change: 0 additions & 1 deletion .vercelignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
examples
node_modules
.*cache
2 changes: 1 addition & 1 deletion docs/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const gh = new URL('https://github.com/mdx-js/mdx/')

export const config = {
input: new URL('./docs/', git),
output: new URL('./build/', git),
output: new URL('./public/', git),
git,
gh,
ghBlob: new URL('./blob/' + branch + '/', gh),
Expand Down
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
"license": "MIT",
"private": true,
"type": "module",
"#": "For `vercel` (to do: set it in vercel dashboard instead)",
"engines": {
"node": ">=14"
},
"workspaces": [
"packages/babel-plugin-remove-export-keywords",
"packages/react",
Expand Down Expand Up @@ -41,7 +37,7 @@
"postinstall": "patch-package",
"prepare": "husky install",
"clean": "npm exec -c \"rimraf node_modules\" --workspaces",
"docs-prep": "node website/prep.js && postcss docs/_asset/index.css -o build/index.css",
"docs-prep": "node website/prep.js && postcss docs/_asset/index.css -o public/index.css",
"docs-bundle-dev": "NODE_ENV=development node website/bundle.js",
"docs-bundle-prod": "NODE_ENV=production node website/bundle.js",
"docs-generate": "NODE_LOADER_CONFIG=website/loader-react-server.js node --no-warnings --experimental-loader @node-loader/core --conditions=react-server website/generate.server.js",
Expand All @@ -53,7 +49,6 @@
"docs-deploy": "vercel && vercel alias $(pbpaste) mdxjs.com && vercel alias $(pbpaste) www.mdxjs.com",
"format": "npm run lint -- --fix",
"lint": "eslint --ext .jsx --report-unused-disable-directives --cache .",
"vercel-build": "npm run docs-prod",
"publish-ci": "# lerna publish -y --canary --preid ci --pre-dist-tag ci",
"publish-next": "# lerna publish --force-publish=\"*\" --pre-dist-tag next --preid next",
"test-api": "npm run test-api --workspaces --if-present",
Expand Down
14 changes: 1 addition & 13 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
{
"version": 2,
"name": "mdx",
"alias": ["v2.mdxjs.com"],
"public": true,
"trailingSlash": true,
"builds": [
{
"src": "package.json",
"use": "@vercel/static-build",
"config": {
"distDir": "build"
}
}
]
"trailingSlash": true
}
6 changes: 3 additions & 3 deletions website/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ webpack(
)
],
output: {
// RSC puts all chunks in `build/` (perhaps due to my weird doing),
// but on a page `build/folder/index.html`, RSC/WP will then load
// `build/folder/chunk.js`, even though it’s at `build/chunk.js`.
// RSC puts all chunks in `public/` (perhaps due to my weird doing),
// but on a page `public/folder/index.html`, RSC/WP will then load
// `public/folder/chunk.js`, even though it’s at `public/chunk.js`.
// This fixes that!
publicPath: '/',
path: url.fileURLToPath(config.output),
Expand Down
2 changes: 0 additions & 2 deletions website/prerender.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ async function main() {
})
)

console.log('files:', await globby('**/index.nljson', {cwd: fileURLToPath(config.output)}));

const files = (
await globby('**/index.nljson', {cwd: fileURLToPath(config.output)})
).map(d => new URL(d, config.output))
Expand Down

1 comment on commit 36cb41b

@vercel
Copy link

@vercel vercel bot commented on 36cb41b Sep 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

Please sign in to comment.