wrong babel cache using filepath as entry point
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- javascript
- 領域
- build-system
調査の方向性
babel-loader の src/index.js にある関連する cachedIdentifier ロジックから始め、babel-plugin-transform-define が設定ファイルのパスをどのように受け取るか、または解決するかを確認します。参照先のファイルを変更して古いキャッシュのケースを再現し、そのファイルの内容が変わったときに node_modules/.cache/babel-loader を手動で削除せずキャッシュが無効化されることを完了条件とします。
索引モデルが issue の本文から書いたものです。
説明
Hey folks, thanks for creating this library, I found it very useful.
I'm opening this issue because I found an edge case related to how babel-loader cache works.
babel-loader uses a prop called cachedIdentifier. This property determinate if it is necessary or not re-run babel-loader process.
https://github.com/babel/babel-loader/blob/b29516266912fbc50120155fee00efb1b0a19f59/src/index.js#L61
The point here is that it reads the content of the .babelrc. All is okay.
The edge case is related with this:
{
"plugins": [
["transform-define", "./path/to/config/file.js"]
]
}
If you use babel-plugin-transform-define specifying a file path, and then you modify the content of the file, in the next babel-loader it will be determinate that a new run is not necessary, so it will be served the last result from the cache that it's different from your expected result!
Literally, I was thinking I was crazy until discovering this.
The fix could be easiest as determinate the new way to calculate cachedIdentifier. The problem is, because in my case I'm under Next.js, that's is not something easy to do because Next.js internal doesn't contemplate this modification.
Ideally, we should do that transparently adding a bit of code inside babel-plugin-transform-define to detect the edge case, but not sure if we can do that, need to investigate around babel-loader API inside a plugin.
My current workaround is remove the cache before init the process:
rm -rf node_modules/.cache/babel-loader && npm run dev
but obviously, this is a very bad solution and slow.
any idea? 🙂
- 主要言語
- JavaScript
- スター
- 242
- フォーク
- 29
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
FormidableLabs/babel-plugin-transform-define のほかの issue
-
enhancement help wanted
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
unverified
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
FormidableLabs/babel-plugin-transform-define#40 · コメント 1 件 ·
FormidableLabs/babel-plugin-transform-define の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
awesome-dsh-plugin/awesome-dsh-plugin#8715 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Document embedding fails with "Cannot have chunkOverlap >= chunkSize" after switching to an embedder with a smaller max chunk length対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Mintplex-Labs/anything-llm#6810 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage Technical TODO
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
AOSSIE-Org/BabyNest#268 ·
メンテナーはふだん 1 日以内に返信
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信