micromatch / glob-fs

file globbing for node.js. speedy and powerful alternative to node-glob. This library is experimental and does not work on windows!
http://jonschlinkert.github.io/glob-fs
MIT License
55 stars 17 forks source link

readdirSync is not a function #15

Closed craigcosmo closed 7 years ago

craigcosmo commented 7 years ago

error: /Users/craigcosmo/Desktop/electron skeleton/webpack.config.babel.js:49 var files = _globFs2.default.readdirSync('*.js'); ^

TypeError: _globFs2.default.readdirSync is not a function

Reproduce

import fs from 'fs'
import glob from 'glob-fs'
let files = glob.readdirSync('*.js');

console.log(files)
jonschlinkert commented 7 years ago

Do you have an example of how to reproduce the bug with code that doesn't need to be transpiled?

craigcosmo commented 7 years ago

Does the package work with es6?

jonschlinkert commented 7 years ago

I was referring to this:

error: /Users/craigcosmo/Desktop/electron skeleton/webpack.config.babel.js:49

How are webpack and babel related to this lib or the example? Or was that part irrelevant?

craigcosmo commented 7 years ago

I wanted to get the folder structure (using your package) so I can use the structure in webpack modulesdirectories.

I was trying to produce something like this ['app', 'app/image', 'app/image/icon', 'dist', 'app/component'] , because this array is something webpack modulesdirectoris is expecting to receive.

I solved this. Like this http://stackoverflow.com/questions/39674832/nodejs-get-folder-structure-recursively-and-synchronously?noredirect=1#comment66650122_39674832

jonschlinkert commented 7 years ago

Oh ok, thanks for clarifying