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

not work after deployed to vercel #291

Closed
lili21 opened this issue Oct 16, 2022 · 7 comments
Closed

not work after deployed to vercel #291

lili21 opened this issue Oct 16, 2022 · 7 comments

Comments

@lili21
Copy link

lili21 commented Oct 16, 2022

I'm running the mdx compiler on the server side on each page request, it works fine on my local machine, but on on vercel.

the error message

no such file or directory, open '/var/task/node_modules/shiki/languages/abap.tmLanguage.json'

@pomber
Copy link
Contributor

pomber commented Oct 16, 2022

Hi, see #283 (comment)

this fixed the issue for me on getServerSideProps

// in your next.js page 
export const config = {
  unstable_includeFiles: ['node_modules/**/shiki/**/*.json'],
};

@lili21
Copy link
Author

lili21 commented Oct 16, 2022

I'm using the remix framework. what config should I apply?

@pomber
Copy link
Contributor

pomber commented Jan 16, 2023

should be fixed with v0.8.0, let me know how it goes

@pomber pomber closed this as completed Jan 16, 2023
@lili21
Copy link
Author

lili21 commented Jan 25, 2023

Could not resolve "@code-hike/mdx/dist/components.cjs.js"

I'm using it with mdx-bundler.

@pomber
Copy link
Contributor

pomber commented Jan 25, 2023

Could not resolve "@code-hike/mdx/dist/components.cjs.js"

I'm using it with mdx-bundler.

Can you share more details?
We have a remix example and a mdx-bundler example (in the examples folder), compare them with yours and check what's different

@lili21
Copy link
Author

lili21 commented Jan 25, 2023

sure. I'm doing it on the server side.

import { bundleMDX } from "mdx-bundler";
import { remarkCodeHike } from "@code-hike/mdx";
import theme from "shiki/themes/nord.json";

export const loader = async () => {
  const data = await fetchFromCRM();

  const result = await bundleMDX({
      source: data,
      mdxOptions(options, frontmatter) {
        options.remarkPlugins = [
          ...(options.remarkPlugins ?? []),
          [
            remarkCodeHike,
            {
              showCopyButton: true,
              theme,
            },
          ],
        ];

        return options;
    },
  });

  return { result }
}

@pomber
Copy link
Contributor

pomber commented Jan 25, 2023

hmm, you may need to use autoImport: false

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

No branches or pull requests

2 participants