Redocly / redoc

📘 OpenAPI/Swagger-generated API Reference Documentation
https://redocly.github.io/redoc/
MIT License
23.61k stars 2.3k forks source link

Error: Can't resolve 'null', Redoc Standalone #930

Closed imdugud closed 5 years ago

imdugud commented 5 years ago

Hello

I am using redoc version 2.0.0-rc.8-1. My code;

import redoc from "redoc/bundles/redoc.standalone";

redoc.init(this.swaggerObj, { scrollYOffset: 50 }, document.getElementById('redoc-container'))

I also tried import as { RedocStandalone }, { init } and { Redoc } , but didn't work.

I got this browser error;

redoc.standalone.js?1c32:7 Uncaught Error: Cannot find module 'null' at webpackMissingModule (redoc.standalone.js?1c32:7) at eval (redoc.standalone.js?1c32:7) at eval (redoc.standalone.js?1c32:7) at Object../node_modules/redoc/bundles/redoc.standalone.js (build.js:15642) at webpack_require (build.js:20) at eval (Documentation.vue?3a40:10) at Object../node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./src/components/api-detail/Documentation.vue?vue&type=script&lang=js& (build.js:1399) at webpack_require (build.js:20) at eval (Documentation.vue?7f4d:1) at Module../src/components/api-detail/Documentation.vue?vue&type=script&lang=js& (build.js:18278)

What I'm doing wrong there?

Thanks for your help.

RomanHotsiy commented 5 years ago

import { RedocStandalone } from 'redoc';

imdugud commented 5 years ago

Unfortunatelly, this time webpack gave "Can't resolve 'styled-components' and 'mobx' errors.

Then, I installed "react react-dom mobx@^4.2.0 styled-components" packages.

Rewrite my code and I got an error as follows;

react.development.js?72d0:388 Uncaught (in promise) TypeError: Cannot set property 'props' of undefined at PureComponent (webpack-internal:///./node_modules/react/cjs/react.development.js:388:14) at RedocStandalone (webpack-internal:///./node_modules/redoc/bundles/redoc.lib.js:13157:42) at VueComponent._callee$ (webpack-internal:///./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./src/components/api-detail/Documentation.vue?vue&type=script&lang=js&:36:42) at tryCatch (webpack-internal:///./node_modules/@babel/polyfill/node_modules/regenerator-runtime/runtime.js:62:40) at Generator.invoke [as _invoke] (webpack-internal:///./node_modules/@babel/polyfill/node_modules/regenerator-runtime/runtime.js:296:22) at Generator.prototype.(anonymous function) [as next] (webpack-internal:///./node_modules/@babel/polyfill/node_modules/regenerator-runtime/runtime.js:114:21) at asyncGeneratorStep (webpack-internal:///./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./src/components/api-detail/Documentation.vue?vue&type=script&lang=js&:14:103) at _next (webpack-internal:///./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./src/components/api-detail/Documentation.vue?vue&type=script&lang=js&:16:194) at

I try to use redoc at my vue project. Is there any other option to use with vue?

tindleaj commented 5 years ago

I came up with a workaround that allowed me to embed the redoc component in an Angular7 app. I posted it in this issue thread.