Error: Rollup failed to resolve import

When building my site ( jolly-twilight-c20825 )

i’m getting the following error:

I think that it’s related with the dynamic import. Because if not specific for this file only (I tried to remove it and it shown in another one)

If I build in my local environment it works fine.

I tried to modify my astro.config.mjs so maybe it can help by adding:

buildOptions: {
    esbuild: {
      define: {
        __VUE_OPTIONS_API__: true,
        __VUE_PROD_DEVTOOLS__: false,
      },

      alias: {
        "@": "./src",
        "@/*": "./src/*"
      },
    },
  },

But still no working.

The path alias is created in my file tsconfig.json.

Another note: maybe is not related but I’m not using vite in my application (saying it because it’s shown in the error message)

Thanks in advance!

I already checked and tried everything related with case sensivity. I even have “forceConsistentCasingInFileNames”: true on my tsconfig.json. But it doesn’t look like my problem.

Okay I found the problem:
In my file tsconfig.json inside the compilerOptions object, the option baseUrl was my local inventory.

Solution:
Setting the baseUrl to the root folder
"baseUrl": "./"

This how my paths look like:

"paths": {
      "@/components/*": [
        "./src/layouts/components/*"
      ],
      "@/shortcodes/*": [
        "./src/layouts/shortcodes/*"
      ],
      "@/helpers/*": [
        "./src/layouts/helpers/*"
      ],
      "@/partials/*": [
        "./src/layouts/partials/*"
      ],
      "@/*": [
        "./src/*"
      ]
    }

I hope this helps someone that faces the same proble.

Thanks!

Hiya :wave:t6: @cesaralvrz thanks for reaching out and sharing your solution with the community. This will help other users who stumble upon this thread. :+1:t6:

1 Like