-
Notifications
You must be signed in to change notification settings - Fork 3k
[static-build] add support for gatsby esm config #9183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[static-build] add support for gatsby esm config #9183
Conversation
expect(contents.some(name => name === 'gatsby-config.mjs')).toBeTruthy(); | ||
// using `import` causes a seg fault. | ||
expect(await fs.readFile(path.join(workPath, 'gatsby-config.mjs'), 'utf-8')) | ||
.toBe(`import userConfig from "./gatsby-config.mjs.__vercel_builder_backup__.mjs"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (non-blocking): make assertion less specific
This test assertion is brittle when we want to change the injected code. What do you think about asserting only the first line, which captures the core of the difference between this type of injection vs. the others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches the other test which utilize snapshots. This stuff rarely changes so I'm fine with leaving as is. Maybe using some other form of snapshotting will work better too
"use": "@vercel/static-build", | ||
"config": { | ||
"zeroConfig": true, | ||
"framework": "gatsby" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe vercel.json can be simplified to a single line now that we support framework
https://vercel.com/docs/project-configuration#project-configuration/framework
{
"framework": "gatsby"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds support for auto injection into Gatsby's new ESM config format. Only injects if the
gatsby-config.mjs
is present, and continues to default generation ofgatsby-config.js