babel-plugin-static-fs icon indicating copy to clipboard operation
babel-plugin-static-fs copied to clipboard

How to bust the Babel cache?

Open callumlocke opened this issue 7 years ago • 2 comments

Thanks for this great plugin.

I'm getting a problem where it doesn't seem to pick up changes to the file being inlined. I have to edit the parent JS file to cachebust it. I think this is because the parent file is stuck in Babel's cache with the inlined string, and Babel doesn't know that the underlying file has changed.

Is there any solution to this? Currently I am having to make an arbitrary whitespace change in the parent file whenever I want to edit the child file. (Excuse terminology.)

callumlocke avatar Aug 17 '17 14:08 callumlocke

I am seeing this too with create-react-app development environment. Also if I'm reverting to an old version, it seems to cache based on the content of the file, it's not as simple as just recompiling. e.g. add a space, compile, it gets new content - remove that space, compile, it actually reverts to the original cache value. So it seems to be caching against some type of checksum or similar which makes it even harder on the workflow....

rgilling avatar May 01 '18 04:05 rgilling

The workaround I'm using now consists in removing all the files on the node_modules/.cache/babel-loader folder. For OS X users it may be needed to use Cmd</Kbd> + Shift + . to show hidden folders (.cache).

It looks like it also happens to other similar plugins, such as kentcdodds/babel-plugin-preval#19, evenchange4/graphql.macro#6 and even babel/babel-loader#453.

jesobreira avatar Jun 20 '18 02:06 jesobreira