createPalette
- Remix - SyntaxError: Cannot use import statement outside a module
#33001
Closed
2 tasks done
Labels
Duplicates
Latest version
Current behavior 😯
Building a ssr app in Remix I have a fully custom theme and for the palette I use the
createPalette
function. In there I do lots of overrides and additions. What I have works as expected in Create React App and I can assume it's webpack doing the magic there with babel.The error when starting Remix dev
If I do not use
createPalette
and just pass a generic palette object to the theme it works as expected.Expected behavior 🤔
I assume the issue is with the babel import, since that's the error it calls out in the stack. But I would assume
createPalette
to work outside a module or whatever is needed. I am using the @latest of all @mui packages and @emotion. I have not included babel in my project.The basic example I can provide is:
Naïve example but I'm doing much more in my use case by adding many more colors and changing existing palette colors to my design theme.
Steps to reproduce 🕹
Steps:
npx create-remix
follow promptscreatePalette
.npm run dev
- open browser to provided uricreatePalette
import and modifycreateTheme
to a generic palette object per official remix exampleContext 🔦
In a broader scope this is my built theme that I'm am using, in production in CRA.
As you can see I do a fair amount of changes and additions.
Elsewhere I export the
ThemeProvider
with theme already attached. Build and publish to a package repository. The import into an app is just a new context provider that takes no props since the theme is already attached.Your environment 🌎
`npx @mui/envinfo`
The text was updated successfully, but these errors were encountered: