babel-loader icon indicating copy to clipboard operation
babel-loader copied to clipboard

Changes to .browserslistrc does not invalidate cache

Open bmbarker90 opened this issue 7 years ago • 5 comments

I'm submitting a bug report

There seems to have been an existing issue #587 related to changes in .babelrc. It looks like it was fixed for .babelrc, but with @babel/[email protected], changes to .browserslistrc can also affect what babel should be outputting.

Webpack Version: 4.20.2

Babel Core Version: 7.1.0

Babel Loader Version: 8.0.2

Please tell us about your environment: OSX 10.13.6

Current behavior: When using cacheDirectory: true, the cache does not get invalidated between changes to .browserslistrc contents. Disabling the cache works as expected and changes to .browserslistrc are reflected in the generated bundle.

Expected/desired behavior: When using cacheDirectory: true, the cache should be invalidated between changes to the .browserslistrc file

  • 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. Configuration
{
  loader: 'babel-loader',
  options: { 
    cacheDirectory: true,
    presets: [
      [
        "@babel/preset-env",
        {
          useBuiltIns: "entry",
          modules: false,
        }
      ],
      "@babel/react", 
      "@babel/typescript",
    ],
    plugins: [
      "@babel/proposal-class-properties",
      "@babel/proposal-object-rest-spread",
      "react-hot-loader/babel",
    ],
  }
}

bmbarker90 avatar Sep 26 '18 15:09 bmbarker90

We could potentially special-case this in babel-loader, but really this is probably related to https://github.com/babel/babel/issues/8497. Happy to leave this open as a tracking issue.

loganfsmyth avatar Sep 26 '18 15:09 loganfsmyth

That sounds great! I wasn't aware of that effort, but seems like it definitely would be the better solution

bmbarker90 avatar Sep 26 '18 16:09 bmbarker90

FYI the PR related to the bug https://github.com/babel/babel/issues/8497 mentioned by @loganfsmyth is having some activity these days: https://github.com/babel/babel/pull/11741. 🤞

Edit: planned for babel 7.17.

meduzen-immoweb avatar Nov 25 '21 18:11 meduzen-immoweb

Is this issue still valid?

steverep avatar Jul 24 '23 17:07 steverep

Is this still an issue with https://github.com/babel/babel/pull/14065 ?

joshua-bn avatar Jan 16 '24 15:01 joshua-bn