babel-plugin-static-fs
babel-plugin-static-fs copied to clipboard
How to bust the Babel cache?
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.)
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....
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.