Mdx-deck: @mdx-deck/layouts @mdx-deck/components do not work

Created on 21 Jul 2019  路  7Comments  路  Source: jxnblk/mdx-deck

Scenario:

Given I am using v3
And I install "@mpx-deck/layouts"
When I import a layout
And I run "npx mdx-deck my-deck.mdx"
Then the build fails

Importing like this:

import { Split } from '@mdx-deck/layouts'

## About

<Split>
  # Hello 
  # Goodbye
</Split>

mdx-deck failing like this

Generating SSR bundle failed

Unexpected token (8:4)

File: ../@mdx-deck/layouts/src/Split.js:8:4

Fixed By: https://github.com/jxnblk/mdx-deck/pull/415

Most helpful comment

K, finally got it. import { Split } from 'mdx-deck

All 7 comments

I checked the code (File: ../@mdx-deck/layouts/src/Split.js:8:4), and it's jsx. So, seems like mdx-deck by default is not transpiling jsx under node_modules

Updating the title as both @mdx-deck/layouts and @mdx-deck/components have the same issue.

As a workaround, we could include these in the webpack config. It can be done in gatsby, but I wonder how to access this in mdx-deck.

https://github.com/jxnblk/mdx-deck/pull/415

猬嗭笍 to add these two packages to the gatsby config

Some of the v2 packages were deprecated in v3. You should import directly from mdx-deck in v3 - see https://github.com/jxnblk/mdx-deck/blob/master/MIGRATION.md#updating-to-mdx-deck-v3

Thanks. I'm still struggling to make this work:

I tried doing instead:

import { Split } from 'mdx-deck/layouts'

Things now failing with

Can't resolve 'mdx-deck/layouts' in '/home/user/slides/node_modules/mdx-deck/.cache/caches/gatsby-plugin-mdx/mdx-scopes-dir'

K, finally got it. import { Split } from 'mdx-deck

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dance2die picture dance2die  路  5Comments

millette picture millette  路  3Comments

broccolini picture broccolini  路  4Comments

wpannell picture wpannell  路  4Comments

kwangkim picture kwangkim  路  4Comments