#Experimental Assets: Rollup failed to resolve import "virtual:image-service"

6 messages · Page 1 of 1 (latest)

random heron
#

Hey guys!

I'm having problems with experimental Assets.
During dev mode, everything is working, but when trying to build, I get the following error:

[vite]: Rollup failed to resolve import "virtual:image-service" from "[OMITTED]/node_modules/.pnpm/astro@2.6.1_@types+node@18.16.2_sharp@0.32.1/node_modules/astro/dist/assets/internal.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
 error   [vite]: Rollup failed to resolve import "virtual:image-service" from "[OMITTED]/node_modules/.pnpm/astro@2.6.1_@types+node@18.16.2_sharp@0.32.1/node_modules/astro/dist/assets/internal.js".
  This is most likely unintended because it can break your application at runtime.
  If you do want to externalize this module explicitly add it to
  `build.rollupOptions.external`

So, I'm using a custom entrypoint, which uses an external in-house service (with Thumbor), basically I just do URL mapping. The entrypoint sets the relative path to this file:

  image: {
    service: {
      entrypoint: 'src/thumbor',
      config: {},
    },
  },
  experimental: {
    assets: true,
  },

Anyway, it's quite strange to be working 100% in development mode and only in build breaking.

modest yew
#

I think you need the file extension

#

./src/thumbor.ts perhaps

#

The error message is a bit generic, but it usually means that it failed to import your entrypoint

random heron
#

I actually identified the problem. It's not the extension because it's working in development mode, and before that I tested it with too.
So, I'm using monorepo with Nx, apparently I need to put the relative path of the project and not the app (which is in apps/[my-app]/src).
Anyway, here's a tip for anyone using Nx and using a custom entrypoint for assets.

Thanks @modest yew

modest yew
#

Ah yeah, monorepos are complicated at times