johannes
johannes
CDCloudflare Developers
Created by Brod on 9/6/2024 in #workers-help
ERROR Could not resolve "cloudflare:workers"
Has anyone managed to solve this error with Vite? I use Hono with its Cloudflare dev server. My vite config looks like this, but I still get the same error that "cloudflare:workers" could not be resolved:
import build from '@hono/vite-build/cloudflare-workers';
import devServer from '@hono/vite-dev-server';
import cloudflareAdapter from '@hono/vite-dev-server/cloudflare';
import { defineConfig } from 'vite';

export default defineConfig(() => {
return {
build: {
minify: false,
rollupOptions: {
output: {
entryFileNames: '_worker.js',
},
external: ['cloudflare:workers'],
},
},
plugins: [
devServer({
adapter: cloudflareAdapter,
entry: './src/index.tsx',
}),
build(),
],
};
});
import build from '@hono/vite-build/cloudflare-workers';
import devServer from '@hono/vite-dev-server';
import cloudflareAdapter from '@hono/vite-dev-server/cloudflare';
import { defineConfig } from 'vite';

export default defineConfig(() => {
return {
build: {
minify: false,
rollupOptions: {
output: {
entryFileNames: '_worker.js',
},
external: ['cloudflare:workers'],
},
},
plugins: [
devServer({
adapter: cloudflareAdapter,
entry: './src/index.tsx',
}),
build(),
],
};
});
16 replies