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

Parcel v2.12.0 is very slow while building ts [HIGHLY CRITICAL] #9958

Open
iamyoki opened this issue Sep 21, 2024 · 0 comments
Open

Parcel v2.12.0 is very slow while building ts [HIGHLY CRITICAL] #9958

iamyoki opened this issue Sep 21, 2024 · 0 comments

Comments

@iamyoki
Copy link

iamyoki commented Sep 21, 2024

I've created a repo to reproduce this problem https://github.com/iamyoki/try-parcel.

image

By controlling the variable method, it can be determined that 2.12.0 will be hundreds of times slower than previous versions when building ts.

🐛 bug report

parcel watch is very slow while building ts while types being generated. It only slows on version 2.12.0, not 2.11.0 or lower. It only slows when "types": "dist/index.d.ts" configured. But even types not being configured, version 2.12.0 is slower than 2.11.0.

The below demo shows a very basic and simplified ts package.

You can clone my repo to reproduce, source code in https://github.com/iamyoki/try-parcel/tree/main/parcel-2.12.0-ts

image

iShot_2024-09-22_01 47 53

The below demo shows the same code and config but in version 2.11.0, very fast, working perfectly.

iShot_2024-09-22_02 05 36

🎛 Configuration (.babelrc, package.json, cli command)

{
  "name": "parcel-2.12.0-ts",
  "version": "1.0.0",
  "description": "",
  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "source": "src/index.ts",
  "scripts": {
    "dev": "parcel watch"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "packageManager": "[email protected]+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b",
  "devDependencies": {
    "@parcel/packager-ts": "2.12.0",
    "@parcel/transformer-typescript-types": "2.12.0",
    "parcel": "^2.12.0",
    "typescript": ">=3.0.0"
  }
}

🤔 Expected Behavior

v2.12.0 should as fast as v2.11.0. Under 10ms per build (caching) should be good.

😯 Current Behavior

200-400ms per build.

💁 Possible Solution

I was able to determine that the build was slow due to the types generation.

Maybe "@parcel/transformer-typescript-types" ?
Maybe "@parcel/packager-ts"?

🔦 Context

Full comparison see https://github.com/iamyoki/try-parcel

Build time comparison

My env:

env version
os macos 14
pnpm 9.11
node 20.17
parcel 2.12.0 vs 2.11.0

My results:

parcel watch (with cache, hmr on), cmd+s source file.

project parcel version build time
ts 2.12.0 200-300ms
ts 2.11.0 2-8ms
js 2.12.0 10-20ms
react 2.12.0 10-15ms
react 2.11.0 2-8ms

💻 Code Sample

https://github.com/iamyoki/try-parcel

🌍 Your Environment

Software Version(s)
Parcel 2.12.0
Node 20.17.0
npm/Yarn 9.10.0
Operating System macos 14
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

1 participant