ample/netlify-plugin-replace

Ignore `node_modules` by default

ehmicky opened this issue · 2 comments

node_modules should not be searched by default. Additionally, it might be good to exclude any directory that is specified in .gitignore. There are several libraries providing with this, such as node-ignore or gitignore-to-glob.

This will make this plugin much faster. What do you think?

Thanks a lot for checking this out @tcmacdonald!

It looks like repositories without a .gitignore crash when the following line is performed:

.add(fs.readFileSync(".gitignore").toString())

Also, node_modules is only excluded for repositories with a .gitignore (whose content includes node_modules). Should it be always excluded from the files search? This might help make this plugin much faster for those repositories, what do you think?

Eeek– not sure how this slipped past me @ehmicky. And yes, I can exclude node_modules irrespective of the presence of .gitignore. Stand by!