-
-
Notifications
You must be signed in to change notification settings - Fork 200
babel-loader cache is not invalidated when browserslist's config changes #514
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
Comments
Hi @wujekbogdan, I think that it does work, but you don't see any change because Encore sets the Could you try disabling that cache to see if that's the case? Encore.configureBabel(options => {
options.cacheDirectory = false;
}); |
Thanks, it works! But I don't fully understand it - if the problem was caused by caching, then why changing the setting in the babel config directly ( UPDATE |
It probably only checks if the direct settings of the loader have been changed, not the external ones parsed by
Sounds like a reasonable thing to do :) |
So it's an issue to resolve on the Babel side, not on the Encore side. Am I right? |
Actually the way it works is documented in the loader's README:
It's be a bit outdated since the code that generates this So, the thing is... the loader doesn't use This means that from the loader's point of view, Babel's config doesn't change if you modify a There is an issue opened on In the meantime your suggestion of disabling that cache for production in Encore seems a good trade-off to me. |
Thanks for the comprehensive answer. I think we can close this issue then. |
This PR was merged into the master branch. Discussion ---------- Don't use babel-loader's cacheDirectory for production Currently `cacheDirectory` is always set to `true` in `babel-loader`'s options. This can be an issue because the cache identifier is only based on direct Babel options, but not on external configs such as `.browserslistrc` files or if a `browserslist` key was added to the `package.json` (see babel/babel-loader#690). Disabling that cache entirely in Encore while waiting for a proper solution in `babel` or `babel-loader` would probably not be a good idea, but we could mitigate the problem by disabling it only for the prod environment. Closes #514 Commits ------- ae74298 Don't use babel-loader's cacheDirectory for production
@Lyrkan to do the same as
but with .bablerc
|
@seyfer AFAIK you can't, We should probably add an option that allows users to say "I know what I'm doing, apply the callback even if there is a |
I found that since webpack 4 upgrade Babel should respect
.browserslistrc
config andbrowserslist
settings frompackage.json
. Neither of these seem to work.The output JS file is always the same, no matter what browserslist settings I use.
If I edit the
@symfony/webpack-encore/lib/loaders/babel.js
file and change thetargets
entry for@babel/preset-env
then the JS output looks as expected.I know that I could use
Encore.configureBabel()
, but I would prefer to use more standard configuration techniques.The text was updated successfully, but these errors were encountered: