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

prebuild-proposal #7908

Closed
jeremy-coleman opened this issue Jul 12, 2019 · 3 comments
Closed

prebuild-proposal #7908

jeremy-coleman opened this issue Jul 12, 2019 · 3 comments

Comments

@jeremy-coleman
Copy link

jeremy-coleman commented Jul 12, 2019

Feature request?

Conceptually, i want to discuss providing an option to separate the bundle and transpile processes.

this repo and example are just using gulp to demo the process. I'm not advocating using gulp. The main idea is that allowing transpilers to run before bundling:

  1. decreases build complexity
  2. allows you to debug transpiled code directly in its pre-minified/bundled form
  3. incremental updates run exponentially faster.
  4. all issues related to typescript are alleviated.
  5. free es3 to esnext support without a need for regenerator runtime, or babel at all.

updated branch : https://github.com/jeremy-coleman/next-tsc-proposal/tree/gulp

image

tsc incremental watch maintains ~1k ms recompile times on ~100k+ loc projects.

this setup also allows you to hot reload assets outside of the react tree (and therefore maintain hot reloads without using webpack)

Describe the solution you'd like(to discuss)

This just adds an intermediate step to the transpile process, which is neccessary for bulk global transforms such as ts (not file by file like babel). The benefit isnt limited to typescript, it allows for codegen of any kind, such as postcss , shader optimizers, etc. It decouples the transpile and bundle step in a transparent and deterministic step.

Describe alternatives you've considered

every alternative imaginable - this is the best i've found, which is why im sharing it

Additional context

looking for feedback / ideas, how to actually integrate into the next cli should be thought about. Likely using the .next cache as a “staging” area would be a good place to start

this setup actually doesn't require babel at all, so you could theoretically remove it as a dependency from next completely

a finished solution would likely include linting to stdout or an in-browser overlay - trivial to implement, leaving out to focus on structure. Dx would be similar to a gulp watcher

tagging
#7848

@jeremy-coleman jeremy-coleman changed the title typescript-proposal prebuild-proposal Jul 16, 2019
@joshleblanc
Copy link

Using tsc for typescript compilation would be great. I can't even use the babel typescript for my project, because due to the (I assume) isolatedModules flag.

@timneutkens
Copy link
Member

We're currently not planning on adding this type of feature as it increases build complexity, both for the user and Next.js, it also slows down your builds and results in less optimal code delivery.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants