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

5.1.0 cacheDirectory=true error

Open smussell opened this issue 11 years ago • 3 comments

After upgrading to 5.1.0 I started getting the following error when I have cacheDirectory=true.

ERROR in ./src/main.jsx
Module build failed: Error: ENOENT, open 'true/994cacc0a9c148dedf802ed858d75ef521881c50.json.gzip'
    at Error (native)

I have removed everything from my main.jsx file except for one line, var x = 5;. If I remove the cacheDirectory=true everything seems to work, or if I downgrade to loader 5.0.0. I'm working on Mac OS 10.10.3.

smussell avatar May 15 '15 18:05 smussell

Can you post a snippet of your config file? I suspect that somewhere the 'true' is being passed as a string, and I would like to check where :)

Also, in the queryString format booleans are given by passing something like: ?cacheDirectory& or ?+cacheDirectory& which means that ?cacheDirectory=true& results in { cacheDirectory: "true"}

couto avatar May 15 '15 19:05 couto

Thanks, that works changing the config to ?cachDirectory& instead of =true, kind of strange that it was working before but broke after the update.

In case you're still curious here is my config:

module: {
    loaders: [
      {test: fromRootDir('/.*\.jsx$'), exclude: /node_modules/, loader: 'babel-loader?cacheDirectory=true&optional=es7.decorators&stage=0'},
      {test: fromRootDir('/src/.*\.json$'), loader: 'json-loader'},
      {test: require.resolve("react"), loader: "expose-loader?React" }
    ]
  },

smussell avatar May 15 '15 19:05 smussell

That was because before the update babel-loader was converting "true" and "false" to boolean, which in my opinion is not correct since the loader already has an explicit syntax to represent boolean values.

Maybe I need to start a changelog.

couto avatar May 15 '15 20:05 couto