-
Notifications
You must be signed in to change notification settings - Fork 142
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
Ensure babel transpilation cache is invalided when changing versions of babel plugins or AST transforms #841
Conversation
a45c8ea
to
12ecbc1
Compare
Ensure we include the package’s version in the configuration, so that the babel-loader can detect module version changes in it’s cache key consideration. Without this, installing a new node_module may not result in babel-loaders cache expiration occurring.
03d5d12
to
60dc72d
Compare
@@ -144,6 +145,36 @@ export function excludeDotFiles(files: string[]) { | |||
return files.filter(file => !file.startsWith('.') && !file.includes('/.')); | |||
} | |||
|
|||
export const CACHE_BUSTING_PLUGIN = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this fixes (2)
useMethod?: string; | ||
} | ||
|
||
const { findUpPackagePath } = resolvePackagePath; | ||
|
||
export function maybeNodeModuleVersion(path: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes 1
9295005
to
3eb7828
Compare
3eb7828
to
8915809
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to write a test for the cache invalidation issue that this resolves?
6dddcda
to
fad8137
Compare
We could add another CI worker to run sequential ember-try scenarios... but it's unclear we can just continue to add those CI jobs... if we want to do that sure, otherwise I think this is adequate given our current priorities. |
Probably. I think we should likely also include targets info, though it may already be included (since its probably part of options to |
I believe these are in there already |
@rwjblue with a fresh mind tomorrow I’ll think about approaches to do a more e2e test that is the right cost/benefit. |
Today, babel’s caches (via babel-loader today) expires caches only if the options passed to it change, unfortunately if you upgrade a plugin without changing the configuration options and the file contents remains the same, the cache will not be evicted. This can lead to spurious caching problems if the associated plugins behavior has changed. To address this defect we now include (when available) the package.json#version of the babel plugins used in our own no-op babel plugin’s configuration. This new no-op plugin is then inserted at the end of the configuration in question.
c6ddb9c
to
e988688
Compare
This includes 2 fixes:
Ensure we include the package’s version in the configuration, so that the babel-loader can detect module version changes in it’s cache key consideration. Without this, installing a new node_module may not result in babel-loaders cache expiration occurring.
We now ensure a given plugins node_module version is included (when available) in the babel configuration. Which ensures the cache is correctly evicted. This is accomplished by adding our own noop babel plugin into the plugin configuration, and having it contain the various plugin path / version pairs.