doczjs / docz

✍ It has never been so easy to document your things!
https://docz.site
MIT License
23.55k stars 1.46k forks source link

Docz build failing for --> @babel/preset-env [exclude] option #1693

Open malhar12 opened 2 years ago

malhar12 commented 2 years ago

Environment for reproduction:

Docz version: 2.3.1
Node version: 14.16.0
babel-preset-gatsby@0.12.3
gatsby-cli@2.19.3
gatsby-graphiql-explorer@0.11.0
gatsby-link@2.11.0
gatsby-page-utils@0.9.1
gatsby-plugin-alias-imports@1.0.5
gatsby-plugin-compile-es6-packages@2.1.1
gatsby-plugin-emotion@4.5.0
gatsby-plugin-eslint@2.0.8
gatsby-plugin-mdx@1.10.1
gatsby-plugin-page-creator@2.10.2
gatsby-plugin-react-helmet-async@1.2.0
gatsby-plugin-root-import@2.0.8
gatsby-plugin-typescript@2.12.1
gatsby-plugin-utils@0.9.0
gatsby-react-router-scroll@3.7.0
gatsby-recipes@0.9.3
gatsby-source-filesystem@2.11.1
gatsby-theme-docz@2.3.1

Command that I'm executing --> yarn docz build --typescript

failed Building production JavaScript and CSS bundles - 4.581s

ERROR #98123  WEBPACK
Generating JavaScript bundles failed
[BABEL] /app/.docz/.cache/polyfill-entry.js: @babel/preset-env: The
plugins/built-ins 'es.error.to-string, es.number.to-exponential' passed to the
'exclude' option are not valid. Please check data/[plugin-features|built-in-features].js in
babel-preset-env (While processing:
"/app/node_modules/@babel/preset-env/lib/index.js")
File: .cache/polyfill-entry.js

ERROR #98123  WEBPACK
Generating JavaScript bundles failed
[BABEL] /app/.docz/.cache/production-app.js: @babel/preset-env: The
plugins/built-ins 'es.error.to-string, es.number.to-exponential' passed to the
'exclude' option are not valid. Please check data/[plugin-features|built-in-features].js in
babel-preset-env (While processing:
"/app/node_modules/@babel/preset-env/lib/index.js")
File: .cache/production-app.js

Not sure, as to what the error is. It says that the plugins/built-ins that are passed to the exclude option are not valid. Tried to override it by passing empty array to it inside gatsby-node.js :

exports.onCreateBableConfig = ({actions}) => {

  actions.setBabelPreset({
    name: "@babel/preset-env",
    options: {
      exclude: []
    }
  });
}

A help here would be much appreciated, as all my builds are failing because it is failing to deploy the documentation.

imp-dance commented 2 years ago

I'm also experiencing the following error while trying to run docz dev:

.../.docz/.cache/develop-static-entry.js: @babel/preset-env: The plugins/built-ins 'es.error.to-string,
es.number.to-exponential' passed to the 'exclude' option are not
    valid. Please check data/[plugin-features|built-in-features].js in
babel-preset-env (While processing: ".../node_modules/gatsby/node_modules/@babel/preset-env/lib/index.js")

File: .cache/develop-static-entry.js

not finished Building development bundle - 4.520s

This after installing docz onto a large React/Typescript project.

I've got no clue how to resolve this. Some insight into what might be causing this error would be really helpful.

renatobenks commented 2 years ago

Hey guys, as far as I got the problem here, it's not related to docz itself as you have your own gatsby setup upfront. The problem is coming from babel-preset-gatsby where you might be using an unsupported version or in the wrong way.

Try to create a reproducible environment, so we can take a further look, but for both of you, the clue is around the babel-preset-gatsby and your gatsby configuration.