question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript support, build too large

See original GitHub issue

Hi Kris, I’ve been working on adding TypeScript support but I’m struggling with Wrangler not building correctly.

The only way I got it to build is by mocking modules in the webpack config like this to get the Apollo stuff to work

resolve: {
    extensions: ['.ts', '.tsx', '.js'],
    alias: {
      fs: path.resolve(__dirname, './src/utils/empty.ts'),
      busboy: path.resolve(__dirname, './src/utils/empty.ts'),
    },
  }

But this build is 2MiB so it can’t get uploaded. Setting it to production mode also didn’t help.

I also think that the way we’re importing stuff from Apollo is a bit weird, I think Apollo should provide a nice interface that builds and compiles just fine instead of having to wrap the server in a function imported from dist. There’s this issue for example that kinda leaves me scratching my head.

I have a simpler TypeScript repo that runs and deploys just fine.

If I get this to work, my plan is to convert a medium-sized codebase to Cloudflare workers. You got any pointers on where I can take this?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

4reactions
jayeshmanncommented, Jul 1, 2021

Can anyone help me with TypeScript implementation of this template?

2reactions
Cerberuscommented, May 24, 2020

By the way, I’m the one who start build a project with typescript that scratch from this boilerplate too.

With a few general dependencies, It take lower than 1 MB.

So, hope you found a root cause soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript Tips: How to reduce the size of a bundle - SharePoint
The new size of a bundle heavily depends on your TypeScript code, TypeScript features you use and the amount of TypeScript files you...
Read more >
How to speed up your TypeScript project? - The Software House
TypeScript became a standard for backend (Node.js) and frontend ... TypeScript support,; Plop for code generation,; built-in support for ...
Read more >
10 Strategies for migrating to TypeScript - Exploring JS
We can support a mix of JavaScript and TypeScript files for our code base. ... For large projects, there may be too many...
Read more >
Compiling and bundling TypeScript libraries with Webpack
Hello, thanks for the very helpful guide! i just have one question I wanted to ask and any help would be greatly appreciated.....
Read more >
Build for production - Lit.dev
(Unless your templates are very large, this is a small optimization). Compile out shady-render. If you're only supporting modern browsers, you can compile...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found