hupe1980 / gatsby-plugin-material-ui

Gatsby plugin for Material-UI with built-in server-side rendering support
MIT License
136 stars 24 forks source link

Build error: webpack warnings on build after upgrade to v3 #68

Open sergkudinov opened 3 years ago

sergkudinov commented 3 years ago

After updating to "gatsby-plugin-material-ui": "^3.0.0" I've got the same issue as #65.

Installed packages:

Error:

warn Unsafe builtin method was used, future builds will need to rebuild all pages
warn WebpackError: Unsafe builtin usage fs.existsSync
    at nikita-docs/node_modules/browserslist/node.js:38:1
    at nikita-docs/node_modules/browserslist/node.js:46:1
    at nikita-docs/node_modules/browserslist/node.js:197:1
    at nikita-docs/node_modules/browserslist/index.js:433:1
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/browsers.js:54:12
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/browsers.js:42:26
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:41:20
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:86:25
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:247:29
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:245:18
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:270:16
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/processor.js:67:27
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/postcss/lib/container.js:138:18
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/postcss/lib/container.js:74:18
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/postcss/lib/container.js:60:16

  36 |     return filenessCache[file]
  37 |   }
> 38 |   var result = fs.existsSync(file) && fs.statSync(file).isFile()
     | ^
  39 |   if (!process.env.BROWSERSLIST_DISABLE_CACHE) {
  40 |     filenessCache[file] = result
  41 |   }

warn WebpackError: Unsafe builtin usage fs.statSync
    at nikita-docs/node_modules/browserslist/node.js:38:1
    at nikita-docs/node_modules/browserslist/node.js:46:1
    at nikita-docs/node_modules/browserslist/node.js:197:1
    at nikita-docs/node_modules/browserslist/index.js:433:1
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/browsers.js:54:12
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/browsers.js:42:26
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:41:20
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:86:25
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:247:29
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:245:18
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:270:16
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/processor.js:67:27
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/postcss/lib/container.js:138:18
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/postcss/lib/container.js:74:18
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/postcss/lib/container.js:60:16

  36 |     return filenessCache[file]
  37 |   }
> 38 |   var result = fs.existsSync(file) && fs.statSync(file).isFile()
     | ^
  39 |   if (!process.env.BROWSERSLIST_DISABLE_CACHE) {
  40 |     filenessCache[file] = result
  41 |   }

warn WebpackError: Unsafe builtin usage fs.existsSync
    at nikita-docs/node_modules/browserslist/node.js:38:1
    at nikita-docs/node_modules/browserslist/node.js:199:1
    at nikita-docs/node_modules/browserslist/node.js:49:1
    at nikita-docs/node_modules/browserslist/node.js:197:1
    at nikita-docs/node_modules/browserslist/index.js:433:1
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/browsers.js:54:12
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/browsers.js:42:26
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:41:20
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:86:25
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:247:29
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:245:18
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/supports.js:270:16
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/autoprefixer/lib/processor.js:67:27
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/postcss/lib/container.js:138:18
    at nikita-docs/node_modules/gatsby-plugin-material-ui/node_modules/postcss/lib/container.js:74:18

  36 |     return filenessCache[file]
  37 |   }
> 38 |   var result = fs.existsSync(file) && fs.statSync(file).isFile()
     | ^
  39 |   if (!process.env.BROWSERSLIST_DISABLE_CACHE) {
  40 |     filenessCache[file] = result
  41 |   }

Environment

  System:
    OS: macOS 10.15.4
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Shell: 5.8 - /usr/local/bin/zsh
  Binaries:
    Node: 15.14.0 - /usr/local/bin/node
    Yarn: 1.22.10 - ~/.npm-global/bin/yarn
    npm: 7.5.3 - ~/.npm-global/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 89.0.4389.114
    Firefox: 87.0
    Safari: 13.1
  npmPackages:
    gatsby: ^3.2.1 => 3.2.1
    gatsby-image: ^3.2.0 => 3.2.0
    gatsby-plugin-catch-links: ^3.2.0 => 3.2.0
    gatsby-plugin-emotion: ^6.2.0 => 6.2.0
    gatsby-plugin-google-analytics: ^3.2.0 => 3.2.0
    gatsby-plugin-manifest: ^3.2.0 => 3.2.0
    gatsby-plugin-material-ui: ^3.0.0 => 3.0.0
    gatsby-plugin-mdx: ^2.2.0 => 2.2.0
    gatsby-plugin-offline: ^4.2.0 => 4.2.0
    gatsby-plugin-react-helmet: ^4.2.0 => 4.2.0
    gatsby-plugin-robots-txt: ^1.5.5 => 1.5.5
    gatsby-plugin-sitemap: ^3.2.0 => 3.2.0
    gatsby-remark-autolink-headers: ^3.2.0 => 3.2.0
    gatsby-remark-prismjs: ^4.2.0 => 4.2.0
    gatsby-remark-title-to-frontmatter: ^1.1.2 => 1.1.2
    gatsby-source-filesystem: ^3.2.0 => 3.2.0
  npmGlobalPackages:
    gatsby: 3.2.1
patspam commented 3 years ago

Any updates here? Disabling autoprefixing isn't ideal..

jkananen commented 3 years ago

For those following this issue, have a look at the latest comments at https://github.com/hupe1980/gatsby-plugin-material-ui/issues/65#issuecomment-903561952

In our case, Mui's Accordion component was the culprit, and using our own implementation instead helped removing the last warnings related to this.