elements icon indicating copy to clipboard operation
elements copied to clipboard

Integration error w/Stoplight and Docusaurus

Open caitlinnew opened this issue 2 years ago • 1 comments

Our documentation website is currently making use of docusaurus and we are trying to integrate stoplight into our website for API documentation. On integrating stoplight with our codebase we get the following error

"Module not found: Error: Can't resolve './dist/abort-controller' Did you mean 'abort-controller.mjs'?"

Context

Our docs are on docusaurus and we tried integrating stoplight elements with docusaurus. We have the api definition file (yml) and also installed the necessary node packages.

We created a JS file and added the stoplight-elements react component to it.

Our JS file looks similar to this https://github.com/dyte-in/docs/blob/main/src/pages/api.jsx On running and building the app we get the following error

"Module not found: Error: Can't resolve './dist/abort-controller' Did you mean 'abort-controller.mjs'?"

Current Behavior

image

gz#9362

(related to Zendesk ticket #9362)

caitlinnew avatar Apr 25 '22 17:04 caitlinnew

This is our docs repo: https://github.com/symblai/symbl-docs

and this is the branch where we attempted stoplight-docusaurus integration: https://github.com/symblai/symbl-docs/tree/api-playground-using-stoplight

Also, this is the list of packages we installed

  • npm i @stoplight/elements
  • npm i stream
  • npm i buffer
  • npm i path
  • npm i url

kushv16 avatar Apr 26 '22 12:04 kushv16

https://stackoverflow.com/questions/74876229/how-to-tweak-docusaurus-webpack-config-for-some-react-component

++ would be great to have an elements-docusaurus-plugin package

currently installed all the packages above, now getting a process not defined error.

jasikpark avatar Jan 25 '23 21:01 jasikpark

core.esm.js?b97d:5645 Uncaught (in promise) ReferenceError: process is not defined
    at eval (core.esm.js?b97d:5645:1)
    at ./node_modules/@stoplight/mosaic/core.esm.js (vendors-node_modules_stoplight_elements_index_mjs.js:1566:1)
    at __webpack_require__ (runtime~main.js:36:33)
    at fn (runtime~main.js:356:21)
    at eval (index.mjs:49:76)
    at ./node_modules/@stoplight/elements-core/index.mjs (vendors-node_modules_stoplight_elements_index_mjs.js:8110:1)
    at __webpack_require__ (runtime~main.js:36:33)
    at fn (runtime~main.js:356:21)
    at eval (index.mjs:5:83)
    at ./node_modules/@stoplight/elements/index.mjs (vendors-node_modules_stoplight_elements_index_mjs.js:8118:1)

jasikpark avatar Jan 25 '23 22:01 jasikpark

image

ah, does this tool not support webpack 5 then?

jasikpark avatar Jan 25 '23 22:01 jasikpark

I resloved this problem by node-polyfill-webpack-plugin

liuxueyong123 avatar May 18 '23 03:05 liuxueyong123

Hello!

Our team recently took over the stewardship of the elements repo.

Due the volume of un-triaged issues that are pretty old and the time it would take us to get caught up on all of them, we kindly ask that you open up a new ticket if this is still an issue you're struggling with.

If you open a new issue please include:

  • clear steps to reproduce that include example OAS specs, application setup, code, etc.
  • the error or issue you are experiencing
  • the expected behavior

We will be triaging any new tickets in a timely manner.

Thank you for understanding!

chohmann avatar Nov 17 '23 22:11 chohmann