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

Does not provide an export named 'default' + vite #344

Open
j-mcfarlane opened this issue Dec 5, 2024 · 2 comments
Open

Does not provide an export named 'default' + vite #344

j-mcfarlane opened this issue Dec 5, 2024 · 2 comments
Assignees
Labels
status: waiting for maintainer These issues haven't been looked at yet by a maintainer vite

Comments

@j-mcfarlane
Copy link

j-mcfarlane commented Dec 5, 2024

Steps to reproduce

Steps:

  1. Create new vite project pnpx create-vite pigment (Currently build 6.0.2, but I also tried vite versions 5.1.8 and 5.0.0)
  2. Install pigment pnpm add @pigment-css/react and @pigment-css/vite-plugin
  3. Update vite config to have pigment({}) plugin
  4. Add import '@pigment-css/react/styles.css' to main.tsx
  5. Remove vite boiler plate styles
  6. Run project pnpm run dev the project will run
  7. Change app.tsx to the following
import { styled } from '@pigment-css/react'

export const Container = styled('div')`
    background: blue;
`

function App() {
    return <Container>App</Container>
}

export default App

Observe the following error

Screenshot 2024-12-05 at 15 36 25

Current behavior

Currently the project throws an error requested module does not provide an export named 'default'

Expected behavior

Should see a blue square

Context

I am trying to add pigment to my vite project

Your environment

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

Search keywords: vite

@j-mcfarlane j-mcfarlane added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 5, 2024
@j-mcfarlane j-mcfarlane changed the title Not working in vite Does not provide an export named 'default' + vite Dec 5, 2024
@joebochill
Copy link

I ran into this yesterday as well. I followed the recommendation in this issue and was able to resolve that error:
#176

But still not able to get the Pigment styles to work in Vite because of: #343

@paulm17
Copy link

paulm17 commented Dec 6, 2024

I'm still running v5 of vite. But when I had the same error. This resolved it for me (in vite config):

optimizeDeps: {
  include: ['prop-types', 'react-is', 'hoist-non-react-statics', 'html-react-parser'],
}

I have more deps, because as for my use case. As soon as I resolved 1, another error followed. So depending on your use case...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for maintainer These issues haven't been looked at yet by a maintainer vite
Projects
None yet
Development

No branches or pull requests

5 participants