Skip to content
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

Can't disable cache with BABEL_DISABLE_CACHE=1 #453

Closed
dwjft opened this issue May 18, 2017 · 7 comments
Closed

Can't disable cache with BABEL_DISABLE_CACHE=1 #453

dwjft opened this issue May 18, 2017 · 7 comments

Comments

@dwjft
Copy link

dwjft commented May 18, 2017

I'm submitting a bug report

Webpack Version:
2.5.1

Babel Core Version:
6.22.1

Babel Loader Version:
6.2.10

Please tell us about your environment:
OS X

Current behavior:
Babel-loader will cache the results from the first build and continue to read from them for future builds, even when BABEL_DISABLE_CACHE=1 is defined.

e.g.: "dev": "BABEL_DISABLE_CACHE=1 webpack-dev-server"

Expected/desired behavior:
No cache should be used at all. All code should be re-compiled every time.

  • 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.

BABEL_DISABLE_CACHE=1 webpack-dev-server

  • What is the expected behavior?
    No cache to be used on future builds.

  • What is the motivation / use case for changing the behavior?
    I don't want my stuff cached.

@loganfsmyth
Copy link
Member

Caching isn't enabled by default, it only happens if you explicitly set cacheDirectory. Are you saying you want to both explicitly enable it, and explicitly disable it? You can check process.env.BABEL_DISABLE_CACHE inside your Webpack config to use that to toggle cacheDirectory if you'd like.

@dwjft
Copy link
Author

dwjft commented May 18, 2017

Babel certainly creates a cache even when I leave the options blank. Something along the way is caching it; perhaps webpack-dev-server in that case?

@loganfsmyth
Copy link
Member

What specifically are you seeing, and what makes you say the issue is Babel-related? You haven't given much to go on yet.

@dwjft
Copy link
Author

dwjft commented May 18, 2017

https://github.com/dwjft/easy-import

I'm using this module. I'm wondering if it is the module caching the package map in memory somewhere; though these cache issues don't exist when transpiling Node.js code, only webpack.

When I add a new package, webpack reloads, but doesn't read the new // @package declaration, so it cannot be imported until a full restart of webpack.

@linonetwo
Copy link

@dwjft kentcdodds/babel-plugin-preval#19 (comment) FYI

@edelreal
Copy link

edelreal commented Mar 16, 2018

I think a more intuitive behavior would be:

if BABEL_DISABLE_CACHE is set, and nothing else is set, then .babel.json is not created or used at all.

We end up removing .babel.json every time in order to force transpiling to happen every time.

@loganfsmyth
Copy link
Member

Currently Babel will invalidate the cache when you change your config or the file content, but otherwise deleting the cache folder is the best way to entirely clear it. As I noted in #453 (comment), babel-loader just depends on the cacheDirectory value so you can always use that + an environment variable to toggle caching on your own.

I've also filed babel/babel#8497 which we'll explore for the preval case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants