material-ui: Build error upgrading from 5.0.0-alpha.20 to 5.0.0-alpha.21
After updating the following dependencies, the project fails at build time:
"@emotion/cache": "11.1.3",
"@emotion/react": "11.1.4",
"@emotion/server": "11.0.0",
"@emotion/styled": "11.0.0",
- "@material-ui/core": "5.0.0-alpha.20",
- "@material-ui/icons": "5.0.0-alpha.20",
- "@material-ui/lab": "5.0.0-alpha.20",
+ "@material-ui/core": "5.0.0-alpha.21",
+ "@material-ui/icons": "5.0.0-alpha.21",
+ "@material-ui/lab": "5.0.0-alpha.21",
Building the app produces the following error. I went through the release changes, but I couldn’t find the reason.
$ next build
Loaded env from /Users/test/mui5-test/.env.production.local
info - Creating an optimized production build
info - Compiled successfully
> Build error occurred
/Users/test/mui5-test/node_modules/@material-ui/core/styles/index.js:1
export { default as adaptV4Theme } from './adaptV4Theme';
^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.9Pu4 (/Users/test/mui5-test/.next/server/pages/_app.js:340:18)
at __webpack_require__ (/Users/test/mui5-test/.next/server/pages/_app.js:23:31)
at Module.hUgY (/Users/test/mui5-test/.next/server/pages/_app.js:1125:15)
at __webpack_require__ (/Users/test/mui5-test/.next/server/pages/_app.js:23:31)
at Object.0 (/Users/test/mui5-test/.next/server/pages/_app.js:106:18)
at __webpack_require__ (/Users/test/mui5-test/.next/server/pages/_app.js:23:31)
at /Users/test/mui5-test/.next/server/pages/_app.js:91:18
at Object.<anonymous> (/Users/test/mui5-test/.next/server/pages/_app.js:94:10)
at Module._compile (internal/modules/cjs/loader.js:999:30)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Process finished with exit code 1
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
Expected Behavior 🤔
Steps to Reproduce 🕹
Steps:
Context 🔦
Your Environment 🌎
`npx @material-ui/envinfo`
System:
OS: macOS 11.1
Binaries:
Node: 12.20.0 - ~/.asdf/installs/nodejs/12.20.0/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.asdf/installs/nodejs/12.20.0/bin/npm
Browsers:
Chrome: 87.0.4280.88
Edge: Not Found
Firefox: 83.0
Safari: 14.0.2
npmPackages:
@emotion/react: 11.1.4 => 11.1.4
@emotion/styled: 11.0.0 => 11.0.0
@material-ui/core: 5.0.0-alpha.21 => 5.0.0-alpha.21
@material-ui/icons: 5.0.0-alpha.21 => 5.0.0-alpha.21
@material-ui/lab: 5.0.0-alpha.21 => 5.0.0-alpha.21
@material-ui/styled-engine: 5.0.0-alpha.21
@material-ui/styles: 5.0.0-alpha.21
@material-ui/system: 5.0.0-alpha.21
@material-ui/types: 5.1.3
@material-ui/unstyled: 5.0.0-alpha.21
@material-ui/utils: 5.0.0-alpha.21
@types/react: 17.0.0 => 17.0.0
react: 17.0.1 => 17.0.1
react-dom: 17.0.1 => 17.0.1
typescript: 4.1.3 => 4.1.3
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 14
- Comments: 17 (10 by maintainers)
@usama-asfar As soon as we make a new release. Maybe tomorrow so that developers coming back from holidays can have a working environment with the latest changes.
Would the following be enough for fixing it in the next time we release it from a Windows machine?
In anycase, we round-robin releases, the next release (v5.0.0-alpha.22) won’t happen from a Windows machine, but we still need to fix it for the next time.
@flpvsk Perfect, thanks for the reproduction. I took some time to explore it further (~10 minutes), especially making it as dead simple as possible while still reproducing the issue. I have found one problem, that might be enough to fix.
https://unpkg.com/browse/@material-ui/core@5.0.0-alpha.20/styles/package.json
https://unpkg.com/browse/@material-ui/core@5.0.0-alpha.21/styles/package.json
It’s the first time we make a release from a Windows machine.
I’m also having the exact same problem, tried deleting node_modules and reinstalled without success, I’m using npm 7 and I don’t think my app uses
adaptV4Theme.@matchatype I’ve tried just now locally the https://github.com/mui-org/material-ui/tree/next/examples/nextjs-with-typescript and it builds and runs successfully. Would recommend comparing the config between your project and that one to see if something is different. It’s hard/impossible for us to debug the issue when we don’t have a clear repro.
I’m also seeing a build issue when using v5.0.0-alpha.21
This only occurs when importing the following:
import {createSvgIcon} from '@material-ui/core';this imports from:
node_modules/@material-ui/icons/utils/createSvgIcon.jswhich has a require statement that is referencing an esm file:
@mnajdova hello! I was just having the same issue. Here’s a minimal reproduction based on the next
npx create-next-app -e with-typescriptrepo:https://github.com/flpvsk/mui-alpha-21-issue-24206
This is where MUI is imported: https://github.com/flpvsk/mui-alpha-21-issue-24206/blob/main/pages/_app.tsx
@mnajdova Sorry, I comment in the wrong thread. Just post it in #24203. And
StylesProviderworks well, thanks a lot!