Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to clear babel cache?

Tags:

eslint

babeljs

I am seeing my eslint rules applied in VSCode however they are not working in Babel. I believe that I need to clear the cache, but I don't know how to do it.

Could you tell me how to do this?

rules

"@typescript-eslint/camelcase": ["warn"],
"camelcase": "off"

Babel output

enter image description here

vscode output

enter image description here

like image 349
yn1043 Avatar asked Oct 21 '25 10:10

yn1043


2 Answers

If you are using a babel.config.js file which looks like below. You can turn off the cache by passing false to api.cache(false)

module.exports = function (api) {
  const presets = [
    [
      '@babel/preset-env',
      {
        useBuiltIns: 'usage',
        corejs: { version: 3, proposals: true }
      }
    ],
    '@babel/preset-react',
    '@babel/preset-flow'
  ];
  const plugins = [

    'lodash',
    ['@babel/plugin-transform-spread', { loose: true }],
    ['@babel/plugin-proposal-class-properties', { loose: true }],
    '@babel/plugin-transform-runtime'
  ];

  /** this is just for minimal working purposes,
     * for testing larger applications it is
     * advisable to cache the transpiled modules in
     * node_modules/.bin/.cache/@babel/register* */
  api.cache(false);

  return {
    presets,
    plugins
  };
};
like image 134
Rain.To Avatar answered Oct 23 '25 07:10

Rain.To


You should delete .babel_cache folder that's create parallel to your output folder.

like image 41
Steric Avatar answered Oct 23 '25 05:10

Steric



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!