docz: Failed to compile v1 and higher
Bug Report
Failed to compile with 3 errors 22:07:38
error in ./node_modules/docz/dist/index.esm.js
Module parse failed: Unexpected token (16:38)
You may need an appropriate loader to handle this file type.
| import { MDXProvider } from '@mdx-js/tag';
|
> const BasePlayground = loadable(() => import('./chunk.esm2.js'));
| const Playground = props => window && typeof window !== 'undefined' ? (createElement(Suspense, { fallback:
null },
| createElement(BasePlayground, Object.assign({}, props)))) : null;
@ ./.docz/app/root.jsx 9:0-59 17:2-15 20:19-23 27:25-31
@ ./.docz/app/index.jsx
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./.docz/app/index.jsx
error in ./node_modules/docz-theme-default/dist/index.esm.js
Module parse failed: Unexpected token (251:34)
You may need an appropriate loader to handle this file type.
| `;
|
> const CodeMirror = loadable(() => import('./chunk.esm2.js'));
| const getLanguage = (children) => {
| const defaultLanguage = 'jsx';
@ ./.docz/app/root.jsx 11:0-39 18:29-34
@ ./.docz/app/index.jsx
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./.docz/app/index.jsx
error in ./.docz/app/imports.js
Module parse failed: Unexpected token (8:11)
You may need an appropriate loader to handle this file type.
| export var imports = {
| 'src/components/AccountNotifications/accountNotifications.mdx': function srcComponentsAccountNotificationsAccountNotificationsMdx() {
> return import(
| /* webpackPrefetch: true, webpackChunkName: "src-components-account-notifications-account-notifications" */
| 'src/components/AccountNotifications/accountNotifications.mdx');
@ ./.docz/app/root.jsx 12:0-36 28:13-20
@ ./.docz/app/index.jsx
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./.docz/app/index.jsx
Expected behavior
In dev and prod mode have this error
Environment
- OS: [ Windows 10]
- Node 8.12.0/npm 6.9.0
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 16
- Comments: 19 (4 by maintainers)
It can solve your problem.
@rakannimer what is the reason this issue get closed?
Same error for me with
docz@1.0.4
on an existing project (macOS, Node v8.11.4).However, a fresh install works fine.
There must be something conflicting with the current project, based on what I saw here:
tldr;
npm ls acorn
showed a missing peerDependency.npm i --save-dev acorn@6.1.1
resolutions
topackage.json
I was having the same issue even with
resolutions
in mypackage.json
. Removing the resolution and addingreact-hot-loader
worked for me.If I add
yarn add --dev webpack
docz builds correctly but when I open the browser I get the following issue:@Glazy I managed to create a repo, the error is not exactly the same as what described here so I created another issue: https://github.com/pedronauck/docz/issues/841
@Glazy sorry I could not reproduce it on my personal laptop today, I might spend sometimes deep into the issue this week using work laptop
Sure, I will find some time to create one On 22 Apr 2019, 1:02 PM +0800, Wee notifications@github.com, wrote: