-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[v2] Migration guide updates #5661
Changes from 1 commit
ddd19d6
8718398
bf0a458
231184a
00d68ee
8053835
bb64597
7afa9d9
f616086
163d7ea
e54d5f9
5413b73
d10adad
ca6d375
433833a
05b1e85
d0cebc7
9124ad1
c5e1c15
2be2dca
b8c4860
405073e
bfc9301
6af965a
d5beb1b
ad47463
ed23990
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,9 +248,7 @@ Note: there will be a `postcss` plugin that allows you to configure postcss from | |
|
||
## Files mixing CommonJS with ES6 modules won't compile | ||
|
||
Gatsby v2 uses a version 7 of [babel](https://babeljs.io/) which is stricter about parsing files with mixed JS styles. | ||
|
||
> TODO: link to babel docs here? | ||
Gatsby v2 uses babel 7 which is stricter about parsing files with mixed JS styles. | ||
|
||
ES6 Modules are ok: | ||
|
||
|
@@ -278,6 +276,8 @@ import foo from "foo" | |
module.exports = foo; | ||
``` | ||
|
||
See [Gatsby's babel docs for more details](/docs/babel). | ||
|
||
## Don't query nodes by ID | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps eg "Rewrite node ID queries"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm I think @m-allanson original wording is correct. There aren't "node ID queries" just queries that might try to query nodes by ID. |
||
|
||
Source and transformer plugins now use UUIDs for IDs. If you used glob or regex to query nodes by id then you'll need to query something else. | ||
|
@@ -286,3 +286,6 @@ Source and transformer plugins now use UUIDs for IDs. If you used glob or regex | |
|
||
> TODO: add example | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a real example from one of my projects. 😄 query MyImageQuery {
allImageSharp(filter: {
- id: {regex: "/default.jpg/"}
+ sizes: {originalName: {regex: "/default.jpg/"}}
}) {
edges {
node {
id
sizes(maxWidth: 660) {
src
}
}
}
}
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks :) |
||
|
||
## Remove explicit polyfills | ||
|
||
If your Gatsby v1 site included any polyfills, you can remove them. Gatsby v2 ships with babel 7 and is configured to automatically include polyfills for your code. See [Gatsby's babel docs for more details](/docs/babel). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't appear to be actually true, or I'm misunderstanding. I had to ship an IntersectionObserver polyfill for marisamorby.com: https://github.com/jlengstorf/marisamorby.com/pull/8/files#diff-3863fe9c963d5c58d29a7f5af77e6480 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gatsby isn't yet compiling code in |
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.
Can we change this to something declarative, eg -- "Convert to either pure CommonJS or pure ES6"?