babel / babel/babel-loader

Expose cache implementation

Open
#831 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.8k
Forks
456
Avg merge
9h 19m
Merged PRs (30d)
2

Description

**I'm submitting a feature request**

Is there any possibility to expose the [cache implementation](https://github.com/babel/babel-loader/blob/master/src/cache.js) as a direct export? Or as a separate package?

A form of this is already done in https://github.com/viankakrisna/loader-fs-cache but already seems to be somewhat out of sync with this version.
It's used in [eslint-loader](https://github.com/webpack-contrib/eslint-loader/blob/master/package.json#L45) as their caching mechanism.

Pulling it directly from here seems like a cleaner solution and I imagine there are multiple other packages that would like to use it.

I realize that there's a possibility to import it like `import cache from 'babel-loader/lib/cache'` but that seems iffy and could break easily.

If implementing it would most likely need to:
- support customizing the default directory
- support passing in a custom `transform` option https://github.com/babel/babel-loader/issues/832.

Contributor guide

Open the contributing guide

Research direction

Start with src/cache.js and compare it with loader-fs-cache and the eslint-loader dependency usage. Review issue 832 for the requested custom transform option and consider how a direct export or separate package would support a configurable default directory. Done means the cache implementation is exposed through a stable interface that covers the stated reuse needs.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.