Open mhartington opened 4 years ago
Same problem here.
Hey, I haven't tested code surfer with mdx-deck v4 yet. I'll give it a try this week.
In the meanwhile, you can always use npx init code-surfer-deck my-deck
if you want a stable/tested configuration.
Same problem here.
@rmarku are you also using gatsby-theme-mdx-deck
?
Same problem here.
@rmarku are you also using
gatsby-theme-mdx-deck
?
Same problem here. Using:
After some testing i'm pretty sure this is a problem with mdx-deck and webpack - I'm getting errors whenever I import anything on my .mdx
files., not just CodeSurfer (although CodeSurfer is definitely the most important and awesome by far)
I'll try to debug over on the mdx-repo with you :)
It is definitely with mdx-deck
. The mdx-deck
related packages are published without transpilation, as the authors of mdx-deck
seem to assume, that Gatsby handles this (which is a bad and incompatible practice, in my opinion).
Nevertheless, I was able to resolve the issue:
gatsby-plugin-compile-es6-packages
as dev-dependency (npm i -D gatsby-plugin-compile-es6-packages
)gatsby-config.js
and add the plugin you installed in step 1: module.exports = {
pathPrefix: "/",
plugins: [
{
resolve: "gatsby-theme-mdx-deck",
- }
+ },
+ {
+ resolve: "gatsby-plugin-compile-es6-packages",
+ options: {
+ modules: ["@mdx-deck/gatsby-plugin"]
+ }
}
]
};
I know this could only ever be a "temporary" solution and is just fighting symptoms instead of solving the root cause (little bit like taking pain-killers when wearing too small shoes).
mdx-deck
packages should ideally follow the convention of pushing a pre-built artifact to npm (instead of pushing bare sources and requiring the consumer to take care for their build).
Edit: Does not solve the issue entirely. I need to check again.
@mister-what hmm. you're definitely on the right track. my silly fix on the other issue was to basically do the same thing, transpile gatsby-plugin-src
, just in the webpack options.
it works with code-surfer 3, but not with 4. i'll try to keep investigating to see how to get the gatsby-theme and v4 to work well together.
To ask a likely-naive question, is this issue blocking updating the mdx-deck dependency to allow for version 4.1.1 generally?
I just added code-surfer to an existing mdx-deck presentation (using yarn add code-surfer
with a resolutions
section in the package.json
set to 4.1.1) and things seem to work. The "build": "mdx-deck build deck.mdx"
in my scripts section seems to function as well (although I don't understand how that differs from what gatsby develop
does in this regard).
To ask a likely-naive question, is this issue blocking updating the mdx-deck dependency to allow for version 4.1.1 generally?
I just added code-surfer to an existing mdx-deck presentation (using
yarn add code-surfer
with aresolutions
section in thepackage.json
set to 4.1.1) and things seem to work. The"build": "mdx-deck build deck.mdx"
in my scripts section seems to function as well (although I don't understand how that differs from whatgatsby develop
does in this regard).
Actually, code imports don't seem to work for me either. Using file=
, that is. @pomber , what component is responsible for parsing the file=
?
Can't seem to get mdx-deck v4.1.1 to work with code-surfer file import either
I spent some hours today to get some combination of dependencies working, so that I can use code-surfer and gatsby and use an pathPrefix to host my presentations on a subpath on some website. I needed to use some older versions, as this is totally fine for me I now am happy with my setup. If anyone is interested:
// package.json
"devDependencies": {
"@babel/core": "^7.0.0",
"@types/react": "^16.9.11",
"@types/react-dom": "^16.9.4",
"gatsby": "^2.13.24",
"gatsby-source-filesystem": "^2.1.48",
"gatsby-theme-mdx-deck": "^3.0.0",
"gatsby-plugin-compile-es6-packages": "2.1.1",
"mdx-deck": "^3.0.10",
"typescript": "^3.7.2",
"code-surfer": "3.1.1",
"react-icons": "4.4.0",
"prismjs": "1.28.0"
},
"dependencies": {
"react": "^16.12.0",
"react-dom": "^16.12.0"
}
// gatsby.config.js
module.exports = {
pathPrefix: '/decks',
plugins: [
{
resolve: 'gatsby-theme-mdx-deck',
options: {
cli: true,
contentPath: 'decks',
},
},
{
resolve: 'gatsby-plugin-compile-es6-packages',
options: {
modules: ['@mdx-deck/themes'],
},
},
],
};
👋 Hey there!
I just threw together a sample project with mdx-deck@v4/gatsby and code-surfer@v3. When I attempted to run
gatsby develop
I got this errorIt seems to be related to code-surfer, though the error being printed is pointing to mdx-deck, so I figured I'd open an issue here and on mdx-deck's repo.
Below is a sample project that should be able to recreate the error.
Sample Project: https://github.com/mhartington/mdx-deck-v4-issue