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

Module parse failed: Unexpected token (13:39) You may need an appropriate loader to handle this file type, #723

Open
linonetwo opened this issue May 25, 2020 · 0 comments

Comments

@linonetwo
Copy link

linonetwo commented May 25, 2020

I have mdx:

# Adder Tree

---

## Example

import AdderTree from './src/AdderTree.jsx';

<AdderTree size={8} />

---

## The End

and

// src/AdderTree.jsx
import React from 'react';
import styled from 'styled-components';
import { range } from 'lodash';

import Adder from './Adder.jsx';

const AdderTreeContainer = styled.div`
  display: flex;
  flex-direction: column;
`;

export default function AdderTree(props) {
  return range(props.size).map((id) => <Adder id={id} />);
}

and

// src/Adder.jsx
import React from 'react';
import styled from 'styled-components';

const AdderContainer = styled.div`
  border: 2px solid #66ccff;
`;

export default function Adder(props) {
  return <AdderContainer>{props.id}</AdderContainer>;
}

The error is:

✖ 「wdm」: 
ERROR in ./src/AdderTree.jsx 13:39
Module parse failed: Unexpected token (13:39)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| 
| export default function AdderTree(props) {
>   return range(props.size).map((id) => <Adder id={id} />);
| }
| 
 @ ./index.mdx 14:17-47
 @ ./node_modules/mdx-deck/dist/entry.js
 @ multi ./node_modules/mdx-deck/dist/entry.js ./node_modules/mdx-deck/lib/overlay.js

What's the possible cause?

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

1 participant