Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to configure in SvelteKit (RemoteAssets is not a function) #1

Closed
taut-and-yare opened this issue Jun 4, 2021 · 2 comments

Comments

@taut-and-yare
Copy link

Hi, I am trying to set this up for a SvelteKit project. Any help would be greatly appreciated.
Below is my config file:

import preprocess from "svelte-preprocess";
import vercel from '@sveltejs/adapter-vercel';
import { imagetools } from "vite-imagetools"
import path from 'path';
import RemoteAssets from 'vite-plugin-remote-assets';

/** @type {import('@sveltejs/kit').Config} */
const config = {
  preprocess: [
    preprocess({
      postcss: true
    }),
  ],
  kit: {
    target: '#svelte',
    adapter: vercel(),
    vite: {
      resolve: {
        alias: {
          $static: path.resolve('./static')
        }
      },
      plugins: [RemoteAssets(), imagetools({ force: true })]
    },
  }
};

export default config;

I am getting this error:

RemoteAssets is not a function
TypeError: RemoteAssets is not a function
    at file:///Users/fekioh/work/svelte/le-groupe-o/svelte.config.js:24:17
    at ModuleJob.run (node:internal/modules/esm/module_job:175:25)
    at async Loader.import (node:internal/modules/esm/loader:178:24)
    at async load_config (file:///Users/fekioh/work/svelte/le-groupe-o/node_modules/@sveltejs/kit/dist/cli.js:502:17)
    at async get_config (file:///Users/fekioh/work/svelte/le-groupe-o/node_modules/@sveltejs/kit/dist/cli.js:557:10)
    at async file:///Users/fekioh/work/svelte/le-groupe-o/node_modules/@sveltejs/kit/dist/cli.js:615:18

When I do console.log(RemoteAssets) I get:

error while updating dependencies:
Error: Build failed with 4 errors:
node_modules/vite-plugin-remote-assets/dist/index.mjs:450:8: error: No matching export in "browser-external:path" for import "extname"
node_modules/vite-plugin-remote-assets/dist/index.mjs:450:17: error: No matching export in "browser-external:path" for import "relative"
node_modules/vite-plugin-remote-assets/dist/index.mjs:450:27: error: No matching export in "browser-external:path" for import "dirname"
node_modules/vite-plugin-remote-assets/dist/index.mjs:450:36: error: No matching export in "browser-external:path" for import "resolve"
    at failureErrorWithLog (/Users/fekioh/work/svelte/le-groupe-o/node_modules/esbuild/lib/main.js:1443:15)
    at /Users/fekioh/work/svelte/le-groupe-o/node_modules/esbuild/lib/main.js:1125:28
    at runOnEndCallbacks (/Users/fekioh/work/svelte/le-groupe-o/node_modules/esbuild/lib/main.js:915:63)
    at buildResponseToResult (/Users/fekioh/work/svelte/le-groupe-o/node_modules/esbuild/lib/main.js:1123:7)
    at /Users/fekioh/work/svelte/le-groupe-o/node_modules/esbuild/lib/main.js:1230:14
    at /Users/fekioh/work/svelte/le-groupe-o/node_modules/esbuild/lib/main.js:606:9
    at handleIncomingPacket (/Users/fekioh/work/svelte/le-groupe-o/node_modules/esbuild/lib/main.js:703:9)
    at Socket.readFromStdout (/Users/fekioh/work/svelte/le-groupe-o/node_modules/esbuild/lib/main.js:573:7)
    at Socket.emit (node:events:365:28)
    at Socket.emit (node:domain:470:12)
[Function: VitePluginRemoteAssets]
@antfu
Copy link
Owner

antfu commented Jun 4, 2021

Maybe RemoteAssets.default?

@taut-and-yare
Copy link
Author

@antfu Thanks for your quick response! FYI, I was trying to combine your plugin with vite-imagetools in order to apply vite-imagetools transformations to remote images.

See the discussion in the issue there. I'd be very interested to hear your take on the feasibility of such an attempt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants