Skip to content
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

Error when running yarn start after yarn build: Named export 'ThemeProvider' not found #1076

Open
ishchts opened this issue Dec 31, 2024 · 1 comment

Comments

@ishchts
Copy link

ishchts commented Dec 31, 2024

You have already researched for similar issues?

Yes, I have searched for similar issues in the repository and could not find any that address this specific problem.

What are you trying to achieve, or the steps to reproduce?

I am trying to start my application after successfully building it, but the application fails to start due to an error related to the @mui/material/styles module.

Steps to reproduce:

  1. Clone my repository: online-shop.
  2. Run yarn install to install dependencies.
  3. Run yarn build (completes successfully).
  4. Run yarn start.
  5. Observe the error.
// The error output
import { createTheme, ThemeProvider } from "@mui/material/styles/index.js";
                      ^^^^^^^^^^^^^
SyntaxError: Named export 'ThemeProvider' not found. The requested module '@mui/material/styles/index.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@mui/material/styles/index.js';
const { createTheme, ThemeProvider } = pkg;

What was the result you received?

The application failed to start, producing the error above.

What did you expect?

The application should start without errors after running yarn start.

Context

  • node version: v20.10
  • package manager: Yarn 4.5.3
  • @mui/material version: 6.1.9
  • os: MacOS Sonoma 14.4
  • repository: online-shop
  • any other relevant information: The issue might be related to the module format (CommonJS vs. ESModules). Adjusting the import statement or build configuration could potentially resolve the issue.
@jsumners
Copy link
Member

How is this a Fastify issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants