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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃殌 Feature Request: Support for typescript #4584

Closed
jadedevin13 opened this issue Dec 10, 2023 · 3 comments
Closed

馃殌 Feature Request: Support for typescript #4584

jadedevin13 opened this issue Dec 10, 2023 · 3 comments
Labels
enhancement New feature or request miniflare Relating to Miniflare

Comments

@jadedevin13
Copy link

Describe the solution

I've tried using something like this in astro cloudflare plugin but it's throwing an error

this._miniflare = new Miniflare({
            cachePersist: `${runtimeConfig.persistTo}/cache`,
            d1Persist: `${runtimeConfig.persistTo}/d1`,
            r2Persist: `${runtimeConfig.persistTo}/r2`,
            kvPersist: `${runtimeConfig.persistTo}/kv`,
            durableObjectsPersist: `${runtimeConfig.persistTo}/do`,
            workers: [
                {
                    name: 'worker',
                    scriptPath: "workers/worker-handler.ts",
                    modulesRules: [{type: "ESModule", include: ["**/*.ts"], fallthrough: true }],
                    modules: true,
                    cacheWarnUsage: true,
                    cache: true,
                    bindings: varBindings,
                    d1Databases: d1Bindings,
                    r2Buckets: r2Bindings,
                    kvNamespaces: kvBindings,
                    durableObjects: durableObjectBindings,
                },
            ],
        });

Relevant Line

@mrbbot
Copy link
Contributor

mrbbot commented Dec 11, 2023

Hey! 馃憢 Miniflare's role is to provide a JavaScript API for the workerd runtime, and provide simulators for the rest of the Cloudflare Developer Platform. Wrangler on the other hand provides a full-workers development experience, including a CLI and support for TypeScript.

Given this, it's unlikely we'll support TypeScript to Miniflare in the near future, as workerd doesn't provide support for it. I'd recommend compiling your TypeScript with tsc or a tool like esbuild before hand, and then passing the built output to Miniflare. We're also working on improvements to Wrangler's API at the moment too. This will provide support for TypeScript at an API level, and frameworks like Astro may want to consider using that when it's ready.

@mrbbot mrbbot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2023
@jadedevin13
Copy link
Author

That's weird because I can pass a typescript file in the wrangler.toml and it will deploy a worker just fine @mrbbot

@jadedevin13
Copy link
Author

Even the worker documentation in cloudflare has a typescript version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request miniflare Relating to Miniflare
Projects
Archived in project
Development

No branches or pull requests

3 participants