Open inuwan opened 2 months ago
What version of @pigment-css/nextjs-plugin
are you using ?
@brijeshb42 I'm using version 0.0.16 of @pigment-css/nextjs-plugin
I am getting the same error on nextjs 14 and 15. (didn't try 13)
tsconfig paths:
"paths": {
"@/*": [
"./src/*"
]
},
and the following on a component:
import { factory } from "@/lib/utils/factory"
const Flex = styled(factory.div)({
"@layer base": {
display: "flex",
},
})
If I change the import line to ../../lib/utils/factory
it then works as expected.
I'm using "@pigment-css/nextjs-plugin": "^0.0.17"
.
Thanks everyone. I've found the issue and am currently working on a fix.
@inuwan Can you try this build where I have tried to fix the issue. Instead of using 0.0.16
in the version, use this -
@pigment-css/react
- @pigment-css/react@https://pkg.csb.dev/mui/pigment-css/commit/cfe48ebe/@pigment-css/react
@pigment-css/nextjs-plugin
- @pigment-css/react@https://pkg.csb.dev/mui/pigment-css/commit/cfe48ebe/@pigment-css/nextjs-plugin
For what is worth, this seems to mostly work. However, if you are in dev mode and change the path to "@/something/something" it it will produce the same error. A server restart fixes the issue.
Same error as below
at Module.evaluate (/node_modules/@wyw-in-js/transform/lib/module.js:224:13)
at evaluate (/node_modules/@wyw-in-js/transform/lib/evaluators/index.js:14:5)
at BaseAction.evalFile (/node_modules/@wyw-in-js/transform/lib/transform/generators/evalFile.js:35:43)
works for me
I found another issue related to this. If you import a component using "@/" (in my case, this is what i have in tsconfig) and try to use the sx prop on it, you get the same error. And then you have to go all the way up the three and remove wherever you have those imports and change them to relative paths.
Same problem when using pure js with jsconfig
and baseUrl
option.
{
"compilerOptions": {
"baseUrl": "src"
}
}
In dev mode most changes require complete restart of the dev server, production builds fail for random baseUrl-relative imports.
I'm getting the exact same problem. The behavior is isolated and definitely caused by pigment bundling. Using @pigment-css/nextjs-plugin version 0.0.20.
Server restarts don't work as @jpmaga suggested.
@brijeshb42 Anything on getting that PR resolved?
Steps to reproduce
"paths":
{"src/": ["./src/"]},`import {getStateName from 'src/common/utils'
4 When compiling the next app, the errorEvalError: Cannot find module 'src/common/utils'
will be experiencedCurrent behavior
Compiler error of
EvalError: Cannot find module
Expected behavior
No compiler error
Context
Use a typescript remapped path
Your environment
``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```npx @mui/envinfo
Search keywords: withPigment typescript path Next.js