ricokahler / next-plugin-preval

Pre-evaluate async functions during builds and import them like JSON
MIT License
255 stars 12 forks source link

Webpack not using jsconfig.json aliases #44

Closed fabien closed 2 years ago

fabien commented 3 years ago

I'm trying to use the aliases defined in in jsconfig.json but unfortunately Preval does not pick them up:

[next-plugin-preval] Error: Cannot find module '@app/sanity/types'

My jsconfig.json :

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@app/*": ["./src/*"]
  },
  "exclude": ["node_modules"]
}
ricokahler commented 3 years ago

Ah, I think this is actually because the upstream package I use to support ts/jsconfig aliases doesn't support jsconfig.json yet.

https://github.com/dividab/tsconfig-paths/issues/127

Maybe try changing it to a tsconfig.json for now and then turn on allowJs: true?

fabien commented 3 years ago

Ah, I see. Will try that later, thanks!

fabien commented 3 years ago

Maybe try changing it to a tsconfig.json for now and then turn on allowJs: true?

Follow-up: this works fine!