Skip to content
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

Import config at build time #14

Merged
merged 5 commits into from
Jul 21, 2022
Merged

Conversation

mfix-stripe
Copy link
Contributor

@mfix-stripe mfix-stripe commented Jul 19, 2022

By importing the config at build time, we are able to run Markdoc.validate with the config that will be used at runtime.

Closes markdoc/markdoc#129

@mfix-stripe mfix-stripe force-pushed the mfix/import-config-at-build-time branch from 1730a55 to aecd247 Compare July 19, 2022 23:23
@mfix-stripe mfix-stripe force-pushed the mfix/import-config-at-build-time branch from 853205a to 968c3b1 Compare July 21, 2022 17:11
@mfix-stripe mfix-stripe force-pushed the mfix/import-config-at-build-time branch from a3e233b to f9f5d46 Compare July 21, 2022 17:42
Copy link
Contributor Author

@mfix-stripe mfix-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

case 'critical': {
logger.error(e.error.message);
break;
// https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/176#issuecomment-683150213
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fast refresh doesn't work during child compilation (which is effectively what importModule is doing). This hack seems to fix it just fine, though. I'm going to chat with the Next.js maintainers to see if there is anything else we can do about this.

global.$RefreshReg$ = noop;
global.$RefreshSig$ = () => noop;

const importAtBuildTime = async (resource) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thoughts on adding a comment here explaining this imports a "runtime" object in memory, where the runtime one creates a build time string that eventually causes a runtime import

@mfix-stripe mfix-stripe merged commit fe0a185 into main Jul 21, 2022
@mfix-stripe mfix-stripe deleted the mfix/import-config-at-build-time branch July 21, 2022 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use registered schema in Next.js validation
2 participants