-
Notifications
You must be signed in to change notification settings - Fork 11
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
Unexpected token '?' after upgrading from 0.0.5 -> 0.1.0 #7
Comments
Hey! |
Is there a reason why you need to publish code that uses features not supported below 14? node 12 is still in maintenance for another year. https://nodejs.org/en/about/releases The following does basically the same thing as the current const write = require("write");
const path = require("path");
const { printSchema } = require("gatsby/graphql");
exports.onPostBootstrap = async ({ store }, options) => {
try {
const defaultLocation = path.resolve(process.cwd(), "schema.graphql");
const defaultGetSchema = async (obj) =>
printSchema(obj, { commentDescriptions: true });
const defaultWriteSchema = async (location, schema) =>
write(location, schema);
const location = options.dest || defaultLocation;
const { schema: internalSchemaObj } = store.getState();
const getSchema = options.getSchema || defaultGetSchema
let schema = (await getSchema(internalSchemaObj));
schema = options.adjustSchema ? await options.adjustSchema(schema) : schema;
const writeSchema = options && options.writeSchema || defaultWriteSchema;
await writeSchema(location, schema);
console.log("[gatsby-plugin-extract-schema] Wrote schema");
} catch (error) {
console.error(
"[gatsby-plugin-extract-schema] Failed to write schema: ",
error
);
}
}; |
You're right :), I wanted to use those features but don't have to in this case. Do you want to create a PR with that @chrbala? Looking at it, that can be merged immediately. |
Thanks for the great plugin! Encountered this problem today as well. Just to emphasize backwards compatibility, this is from gatsby docs:
|
I receive this error when upgrading. Is it worth just replacing the usages of ?? with || (if falsey check is applicable) to avoid any compiler issues?
Edit: forgot to mention I tried the suggested addition of
babel-preset-gatsby
in babel config, but that did not help.The text was updated successfully, but these errors were encountered: