When using the latest redoc-cli (0.6.4), which uses [email protected], I get the following error:
TypeError: createGlobalStyle is not a function
redoc-cli on the petstore:shell
redoc-cli bundle petstore.yaml -o petstore/
/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:7303
var PSStyling = createGlobalStyle(perfect_scrollbar_templateObject_1 || (perfect_scrollbar_templateObject_1 = external_tslib_["__makeTemplateObject"](["", ""], ["", ""])), perfect_scrollbar_default.a && perfect_scrollbar_default.a.toString());
^
TypeError: createGlobalStyle is not a function
at Module.<anonymous> (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:7303:17)
at __webpack_require__ (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:36:30)
at /usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:100:18
at /usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:103:10
at webpackUniversalModuleDefinition (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:9:20)
at Object.<anonymous> (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:16:3)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
Adding styled-components 4.0.3 to the dependencies solved it for me.
Don't work for me... I am on windows 10 OS. and using latest code from master branch
createGlobalStyle is not a functionDoes not help.
yarn add [email protected]
npx redoc-cli --version
createGlobalStyle is not a function
I'm not sure that simply adding the peer dependency styled-components is a viable solution. As indicated by other people, this does not seem to solve the issue.
Could you please try [email protected]?
It works
It's seems that the release of [email protected] fixes the problem. However I'm still not sure that adding the peer dependency of styled-components is a viable solution.
@idelsink it is.
redoc is using styled components as a peerDependency and recently the code base was updated to use styled-components@4 which doesn't have injectGlobalStyle anymore.
redoc-cli included redoc as a dependency so has to install valid version of its peer dependencies itself. Before redoc-cli used [email protected] which is incompatible with 4.x
Can confirm: using [email protected] works.
Most helpful comment
It works