question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: fileSystem.statSync is not a function in 7.1.2

See original GitHub issue

I’m submitting a bug report

Webpack Version: 1.15.0

Babel Core Version: 6.26.0

Babel Loader Version: 7.1.2

Please tell us about your environment: OSX 10.12.6

Current behavior: I’m getting following error when building with gulp and webpack:

[12:52:08] Using gulpfile gulpfile.js
[12:52:08] Starting 'build'...
[12:52:09] Version: webpack 1.15.0

ERROR in ./src/entry.js
Module build failed: TypeError: fileSystem.statSync is not a function
    at module.exports (node_modules/babel-loader/lib/utils/exists.js:7:25)
    at find (node_modules/babel-loader/lib/resolve-rc.js:13:9)
    at Object.module.exports (node_modules/babel-loader/lib/index.js:113:132)
[12:52:09] Finished 'build' after 1.17 s

Gulp ran 1 task in 1.17 s

Here is my Gulp script:

module.exports = function (gulp, config, plugins) {
  return function () {
    return gulp.src(config.sources.concat(config.lib))
      .pipe(plugins.webpack({
        entry: config.entry,
        output: {
          filename: 'lib.js',
          library: 'lib',
          libraryTarget: 'var'
        },
        module: {
          loaders: [{
            test: /.js$/,
            loader: 'babel-loader',
            exclude: /node_modules/,
            query: {
              presets: ['es2015']
            }
          }]
        },
        node: {
          fs: 'empty'
        }
      }))
      .pipe(gulp.dest(config.dist + 'js/'));
  };
};

In version 7.1.1 of babel-loader the problem did not occur. The reason is probably because all errors in exists.js are swallowed in 7.1.1:

  try {
    exists = fileSystem.statSync(filename).isFile();
  } catch (e) {}

When I remove try & catch in 7.1.1, I’m getting the same error as in 7.1.2.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:13
  • Comments:19 (3 by maintainers)

github_iconTop GitHub Comments

26reactions
JackyTungcommented, Aug 28, 2017

My temporarily solution is downgrade babel-loader to 7.1.1

yarn add babel-loader@7.1.1 --dev
24reactions
danezcommented, Aug 21, 2017

babel-loader >= 7.0.0 is only for webpack >=2.2.0

For webpack 1.x please use babel-loader 6.x

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module build failed: TypeError: fileSystem.statSync is not a ...
trying to run a reactjs application , but I am getting this error. Module build failed: TypeError: fileSystem.statSync is not a function.
Read more >
Node.js fs.statSync() Method - GeeksforGeeks
Returns: It returns a Stats object which contains the details of the file path. Below examples illustrate the fs.statSync() method in Node.js:
Read more >
webpack报错Module build failed: TypeError - CSDN博客
/src/main.jsModule build failed: TypeError: fileSystem.statSync is not a function at module.exports (F:\HTML5\学习...
Read more >
Node.js v19.3.0 Documentation
calls() and will throw an error for functions that have not been called the expected number of times. import assert from 'node:assert'; //...
Read more >
Node.js v8.16.0 Documentation
Credentials; DEP0012: Domain.dispose; DEP0013: fs asynchronous function ... Experimental features are not subject to the Node.js Semantic Versioning model.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found