-
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
[wip] revert compling cache-dir and remove non standard code from cache-dir #6183
Conversation
Deploy preview for using-drupal ready! Built with commit 9a5b113 |
Deploy preview for using-drupal ready! Built with commit fb8efee |
Deploy preview for gatsbygram ready! Built with commit 500886e |
Deploy preview for gatsbygram ready! Built with commit fb8efee |
Actually, because we don't use |
It'd be cool if there was like an eslint plguin for only allowing stuff preset-env can compile, like nothing that isn't standardized or implemented |
I didn't find anything like that for eslint, but maybe we could add test to try to run babel on cache-dir with minimal config to catch changes that would add any non standard stuff? |
@jquense how about something like pieh/gatsby@9a5b113...pieh:ie11-promise-test (proof of concept)
|
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.
Looks good! This will fix #6102 as well once in.
@@ -4,7 +4,10 @@ import PageRenderer from "./page-renderer" | |||
import { StaticQueryContext } from "gatsby" | |||
import socketIo, { getStaticQueryData, getPageQueryData } from "./socketIo" | |||
|
|||
const getPathFromProps = props => props.pageResources?.page?.path | |||
const getPathFromProps = props => |
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.
Why revert this?
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.
Maybe I don't need to revert this, I thought this needed something like transform-optional-chaining
plugin. I'll re-check it.
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.
Yeah, so after reverting and running my WIP test ( pieh/gatsby@9a5b113...pieh:ie11-promise-test ) for this:
$ jest minimal-config
FAIL packages\gatsby\cache-dir\__tests__\minimal-config.js
× Builds cache-dir with minimal config (913ms)
● Builds cache-dir with minimal config
expect(received).toEqual(expected)
Expected value to equal:
""
Received:
"{ SyntaxError: D:\\dev\\gatsby-v2\\packages\\gatsby\\cache-dir\\json-store.js: Support for the experimental syntax 'optionalChaining' isn't currently
enabled (7:54):
5 | import socketIo, { getStaticQueryData, getPageQueryData } from \"./socketIo\"
6 |
> 7 | const getPathFromProps = props => props.pageResources?.page?.path
| ^
8 |
9 | class JSONStore extends React.Component {
10 | constructor(props) {
Add @babel/plugin-proposal-optional-chaining (https://git.io/vb4Sk) to the 'plugins' section of your Babel config to enable transformation.
This was fine previously because I was applying same babel config used to build packages for cache-dir
(which includes @babel/plugin-proposal-optional-chaining
)
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.
🙏 👍
#5637 might be to aggressive to transpile it - right now
@babel/preset-env
doesn't know it needs to polyfillPromise
used incache-dir
, which breaks runtime in ie 11 ( #6103 )This attempt just removes flow types and move cache-dir to same place it was before.
closes #6103
closes #6102