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
cacheIdentifier
option as a function?
#946
Comments
As a workaround, you can create const babelConfig = fs.readFileSync("path/to/babel/Config");
const { version: babelVersion } = require("@babel/core");
const { version: babelLoaderVersion } = require("@babel/loader");
{
loader: 'babel-loader',
options: {
cacheIdentifier: [babelConfig, babelVersion, babelLoaderVersion, other_variables].join('\0');
}
} It should be even faster than the defaults because the config is not serialized. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
BEFORE YOU SUBMIT please read the following:
I'm submitting a feature request
Webpack Version:
5.x
Babel Core Version:
7.18.x
Babel Loader Version:
8.2.x
Please tell us about your environment:
OSX 13.x
Current behavior:
cacheIdentifier
is an option that defaults to stringified json with@babel/core
version,babel-loader
version, and "options
" object.https://github.com/babel/babel-loader/blob/v8.2.5/src/index.js#L189-L193
Expected/desired behavior:
Want to be able to set it to a function whose argument includes values used in the default value.
Maybe something like this could work.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.
What is the expected behavior?
What is the motivation / use case for changing the behavior?
The default value makes sense for most use cases and includes info that depends on the file being transpiled, such as filename, but I can't access it :/
The text was updated successfully, but these errors were encountered: