Gatsby plugin to provide VS Code’s syntax highlighting to Markdown code fences
As per the Gatsby migrations docs, we can't use `fs` anymore to import the GraphQL schema https://www.gatsbyjs.com/docs/reference/release-notes/migrating-source-plugin-from-v3-to-v4/#the-new-way-4 _old way_ ```ts const fs = require("fs") const path = require("path") exports.createSchemaCustomization = ({ actions }) => { const { createTypes } = actions const typeDefs = fs.readFileSync( // .gql file with the SDL path.resolve(__dirname, "schema.gql"), "utf8" ) createTypes(typeDefs) } ``` _new way_ ```ts // JS file containing the SDL strings now const typeDefs = require("./schema") exports.createSchemaCustomization = ({ actions }) => { const { createTypes } = actions createTypes(typeDefs) } ``` We do pretty much the same, so: 1. Moved the GraphQL schema in a template literal in a js file 2. Imported that file in the script that generates the types 3. Moved the type declarations one folder up to avoid TS conflicts 4. Imported the GraphQL schema from the new file in the `createSchemaCustomization` hook This should now allow us to us the plugin with GatsbyV4. Tested with `npm pack` and local import in my website. --- Fixes: https://github.com/andrewbranch/gatsby-remark-vscode/issues/174
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by dimitrisnl and has received 11 comments.