In NodeJS I have:
const fs = require('fs');
if (!fs.existsSync("some_path")) {
...
}
But I get the error:
TypeError: fs.existsSync is not a function
After doing some searching, I read that Webpack
brings its own require
which clobbers node.js
's require
, so when you require a node.js
core module that webpack
can't resolve to one of your files or dependencies, it throws.
(My stack trace includes __webpack_require__
)
But how can I fix it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…