You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you add a pigment to a new Vite project, following the instructions in the README.md, you get the following error on build:
TypeError: [vite-mui-theme-injection-plugin] Could not load �zero-runtime-styles.css (imported by src/app/main.jsx): Cannot read properties of undefined (reading 'generateStyleSheets')
Turns out the plugin blows up right now unless you add a theme into the config:
// This fails
export default defineConfig({
plugins: [
pigment({}),
react()
]
});
// This works
export default defineConfig({
plugins: [
pigment({
theme: {}
}),
react()
]
});
I'm not entirely sure if this is a documentation issue or an actual bug, but I feel like it's nice to not require a project to always supply a theme.
Steps:
Create a new Vite project using: yarn create vite my-vue-app --template react
oliviertassinari
changed the title
[bug] Theme injection error in Vite without a theme
[vite] Theme injection error in Vite without a theme
May 9, 2024
Steps to reproduce
When you add a pigment to a new Vite project, following the instructions in the README.md, you get the following error on build:
TypeError: [vite-mui-theme-injection-plugin] Could not load �zero-runtime-styles.css (imported by src/app/main.jsx): Cannot read properties of undefined (reading 'generateStyleSheets')
Turns out the plugin blows up right now unless you add a theme into the config:
I'm not entirely sure if this is a documentation issue or an actual bug, but I feel like it's nice to not require a project to always supply a theme.
Steps:
yarn create vite my-vue-app --template react
yarn build
Repro available in this codespace: https://musical-guacamole-45qr7r77xq2jpg5.github.dev/
Current behavior
Following the README's instructions for a Vite project, you will get a build error instead of a cleanly built project.
Expected behavior
Ideally not including a template doesn't throw an error at build time. Otherwise the README should specify that a theme is required
Context
No response
Your environment
npx @mui/envinfo
Search keywords: theme pigment
The text was updated successfully, but these errors were encountered: