Skip to content

Babel-plugin-import plugin results in every component returning undefined #2

@hdkshingala

Description

@hdkshingala

Search keywords

babel

Latest version

  • I have tested the latest version

Steps to reproduce

Steps:

Open this link to live example: https://stackblitz.com/edit/github-rga63amd?file=vite.config.ts
Let it run.

Current behavior

Following the docs here, I tried setting up bundle minimizing. However, every component becomes undefined.

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vite.dev/config/
export default defineConfig({
plugins: [
react({
babel: {
plugins: [
[
'babel-plugin-import',
{
libraryName: '@mui/material',
libraryDirectory: '',
camel2DashComponentName: false,
},
'core',
],
[
'babel-plugin-import',
{
libraryName: '@mui/icons-material',
libraryDirectory: '',
camel2DashComponentName: false,
},
'icons',
],
],
},
}),
],
});
Uncaught ReferenceError: CssBaseline is not defined and so on.

Tested on v7.0.2, on both Firefox and Chrome.

Expected behavior
No response

Context
No response

Your environment
npx @mui/envinfo
Don't forget to mention which browser you used.
Output from npx @mui/envinfo goes here.

Expected behavior

No response

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions