Hi, I still have the problem declared in the issue number 814
Problem:
Failed to compile
./node_modules/redoc/bundles/redoc.lib.js
Module not found: Can't resolve 'core-js/es6/promise' in '/home/gekinci/projects/pmu/pmu-redoc/node_modules/redoc/bundles'
My dependencies (package.json):
"dependencies": {
"core-js": "^3.1.4",
"es6-promise": "^4.2.8",
"mobx": "^4.13.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1",
"redoc": "^2.0.0-rc.10",
"styled-components": "^4.3.2"
}
Installed with:
npm install mobx@^4.2.0 styled-components core-js es6-promise
npm install redoc --save
So I've installed the following dependency: core-js but nothing has changed. So I've looked into your Redoc code in /node_modules/redoc/bundles/redoc.lib.js:
module.exports = require("core-js/es6/promise");
But what you're looking for with core-js is installed here: core-js/es/promise, not here: core-js/es6/promise
Workaround:
So my workaround was to copy/paste the existing /node_modules/core-js/es folder and rename it to /node_modules/core-js/es6. Is this a bug or did I miss something during the installation of Redoc with npm?
I don't understand why you have closed this issue without indicating what the problem was, or what I've had to do to resolve it.
The best workaround I've found was to install this old version of core-js: 2.6.8 because it contains es6 (also es5 and es7) folders.
I updated 2.0.0-rc.12 => 2.0.0-rc.14 and ran into this issue. Reverting for now but +1
@eau-de-la-seine Just upgrading redoc to rc.14 and core-js to version 3 should work.
@qw-in could you provide more details? Have you upgraded core-js to version 3?
@RomanHotsiy please reopen this issue until #1018 or another fix is resolved.
Thanks!
I opened an issue here when encountering this problem with Gatsby (does not occur with skeleton Webpack config).
I didn't find this originally as it was closed, this issue should be open.
@RomanHotsiy Can confirm a similar error occurs with core-js 3.2.1 and redoc 2.0.0-rc.14.
I get Module not found: Error: Can't resolve 'core-js/es/promise' (and not es6), which is a valid export, more context is available in the above Gatsby issue.
While on the subject, would it not be easier creating a redoc-react package which includes all the required peer dependencies instead of clogging up package.json with extra requirements?
@MarcusCemes Gatsby currently will hardcode core-js@2 causing this error https://github.com/gatsbyjs/gatsby/issues/17136 . I agree though that redoc should not require a specific core-js version externally.
This means that currently redoc@>2.0.0-rc.12 does not work with Gatsby.
I used patch-package as a workaround to get Gatsby working with redoc by changing the import to core-js/es6/promise
This answer solves the issue for my documentation with Gatsby.
I'm still encountering this error when using with next.js. Can we reopen?
@adamsoffer any details?
Most helpful comment
I used patch-package as a workaround to get Gatsby working with redoc by changing the import to
core-js/es6/promise