Skip to content

Build error upgrading from 5.0.0-alpha.20 to 5.0.0-alpha.21 #24206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
matchatype opened this issue Dec 31, 2020 · 17 comments
Closed
2 tasks done

Build error upgrading from 5.0.0-alpha.20 to 5.0.0-alpha.21 #24206

matchatype opened this issue Dec 31, 2020 · 17 comments
Labels
bug 🐛 Something doesn't work

Comments

@matchatype
Copy link
Contributor

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 
@matchatype matchatype added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 31, 2020
@ChiaJune

This comment has been minimized.

@mnajdova
Copy link
Member

@matchatype I managed to successfully run & build our nextjs example - https://github.com/mui-org/material-ui/tree/next/examples/nextjs

I added usage to the adaptV4Theme as well, and it still worked as expected. Can you please share small reproduction, github repo could be perfect.

@mnajdova
Copy link
Member

@matchatype sorry I saw now that you use typescript. Let me try the example of nextjs with typescript and will give more feedback.

@mnajdova

This comment has been minimized.

@xs9627

This comment has been minimized.

@matchatype

This comment has been minimized.

@oliviertassinari oliviertassinari added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 31, 2020
@mnajdova
Copy link
Member

mnajdova commented Dec 31, 2020

@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.

@lednhatkhanh
Copy link

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.

@flpvsk
Copy link

flpvsk commented Dec 31, 2020

@mnajdova hello! I was just having the same issue. Here's a minimal reproduction based on the next npx create-next-app -e with-typescript repo:

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

node -v # v15.5.0
npm -v # 7.3.0

@oliviertassinari oliviertassinari removed the status: waiting for author Issue with insufficient information label Dec 31, 2020
@oliviertassinari
Copy link
Member

oliviertassinari commented Dec 31, 2020

@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.

{
 "sideEffects": false,
 "module": "./index.js",
 "main": "../node/styles/index.js",
 "types": "./index.d.ts"
}

https://unpkg.com/browse/@material-ui/[email protected]/styles/package.json

{
  "sideEffects": false,
  "module": "./index.js",
  "main": "..\\node\\styles\\index.js",
  "types": "./index.d.ts"
}

https://unpkg.com/browse/@material-ui/[email protected]/styles/package.json

It's the first time we make a release from a Windows machine.

@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Dec 31, 2020
@oliviertassinari
Copy link
Member

oliviertassinari commented Dec 31, 2020

Would the following be enough for fixing it in the next time we release it from a Windows machine?

diff --git a/scripts/copy-files.js b/scripts/copy-files.js
index 146adead04..229b21d7da 100644
--- a/scripts/copy-files.js
+++ b/scripts/copy-files.js
@@ -31,7 +31,7 @@ async function createModulePackages({ from, to }) {
       const packageJson = {
         sideEffects: false,
         module: './index.js',
-        main: path.join('../node', directoryPackage, 'index.js'),
+        main: `../node/${directoryPackage}/index.js`,
         types: './index.d.ts',
       };

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.

@mainfraame

This comment has been minimized.

@oliviertassinari oliviertassinari changed the title Build error in nextjs app upgrading from 5.0.0-alpha.20 to 5.0.0-alpha.21 Build error upgrading from 5.0.0-alpha.20 to 5.0.0-alpha.21 Jan 1, 2021
@usamaasfar
Copy link

When this going to solve?

@oliviertassinari
Copy link
Member

When this going to solve?

@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.

@LucaNerlich
Copy link

I am experiencing the same issue, since ive upgraded once to Alpha 21. Even after reverting my package.json and cleaning the npm cache, the problem persists.

@oliviertassinari
Copy link
Member

v5.0.0-alpha.22 was released

@samkelleher
Copy link

I'm on @mui/[email protected] and still have this issue.

/node_modules/@mui/material/styles/index.js:1
export { default as adaptV4Theme } from './adaptV4Theme';
^^^^^^

SyntaxError: Unexpected token 'export'
    at compileFunction (<anonymous>)
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1031:15)
    at Module._compile (node:internal/modules/cjs/loader:1065:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.@mui/material/styles/index.js (/dist/webpack:/project/external commonjs "@mui/material/styles/index.js":1:1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

No branches or pull requests