docz: Module parse failed: Unexpected token (473:30)
Bug Report
Clean install of last version of docz. When I run docz dev, I got:
./node_modules/docz/dist/index.m.js 473:30
Module parse failed: Unexpected token (473:30)
You may need an appropriate loader to handle this file type.
| async function loadFromImports(path) {
| // tslint:disable-next-line
> const { imports } = await import('~imports');
| const { default: Component$$1, getInitialData } = await imports[path]();
| const ExportedComponent = props => (createElement(AsyncComponent, Object.assign({}, props, { as: Component$$1 || 'div', getInitialData: getInitialData })));
@ ./node_modules/docz-theme-default/dist/index.m.js 39:0-72 243:12-16 374:35-39 466:34-45 467:8-12 511:25-29 552:50-54 640:16-27 643:41-45 942:20-24 1024:28-39 1098:16-27 1490:33-44 1601:16-27 1872:16-27 1935:29-40 2029:45-56 2040:25-36 2041:8-18 2073:16-21
@ ./.docz/app/root.jsx
@ ./.docz/app/index.jsx
@ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./node_modules/@babel/polyfill/lib/index.js ./.docz/app/index.jsx
I can’t share a project link.
I check webpack aliases with:
modifyBundlerConfig : (config) => {
console.log(config.resolve.alias);
return config;
}),
and ~imports
is present.
Thanks in advance
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 23
- Comments: 24 (6 by maintainers)
If someone is stuck on this, and following @dfee’s hints, this seems to fix it:
npm i -D webpack@4.28.4
I can tell you @pedronauck exactly where the problem is:
The incompatibility lies with an upgrade of
webpack@4.28.4
->webpack@4.29.0
.Just got the same problem on a fresh installation. For me, the issue got solved by creating the project again with Yarn. npm installation failed with the error similar to what @ohardy posted.
Reproduction of an error:
Reproduction of a success:
Full error:
Versions:
Hope this might help in some way.
Thanks @dfee, this is already fixed on
v0.14
that will be launch. Can I close this issue?Definitely getting the same issue. I can share my project.
https://github.com/dfee/rbx/
Thanks a lot for your help. It looks like everything works with Yarn, and the problem appears only with NPM and the WebPack issue. I have an empty project for testing with only a
package.json
and using the instructions from @mattietea, I have managed to make docz work, but now I have an error in the browser. I think I will use Yarn until the docz@0.14 update.@bichotll I think they mean you need to update the version inside
node_modules/docz-core
. I’ve been using thiscd node_modules/docz-core && npm i -D webpack@4.28.4 && cd .. && cd ..
@timbergus I had the same issue, it gets solve if you lock
buble@0.19.6
. I opened an issue around this: https://github.com/bublejs/buble/issues/189fyi pedro is currently sick and will get back to this in a few days (i dont speak for him but just relaying the info)
when will v0.14 be released?