Skip to content

Commit

Permalink
fix next.js validation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix-stripe committed Sep 29, 2022
1 parent ef4b1ff commit b36363c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@ async function load(source) {
// This is just to get subcompilation working with Next.js's fast refresh
let previousRefreshReg = global.$RefreshReg$;
let previousRefreshSig = global.$RefreshSig$;
let previousDocument = global.$RefreshSig$;
let previousDocument = global.document;
let previousElement = global.Element;
// https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/176#issuecomment-683150213
global.$RefreshReg$ = noop;
global.$RefreshSig$ = () => noop;
global.document = {querySelector: noop};
global.document = previousDocument || {
querySelector: noop,
querySelectorAll: noop,
};
global.Element = class Element {};

// This imports the config as an in-memory object
Expand All @@ -100,6 +103,8 @@ async function load(source) {
};

const errors = Markdoc.validate(ast, cfg)
// tags are not yet registered, so ignore these errors
.filter((e) => e.error.id !== 'tag-undefined')
.filter((e) => {
switch (e.error.level) {
case 'debug':
Expand Down

0 comments on commit b36363c

Please sign in to comment.