Answer the question
In order to leave comments, you need to log in
What causes the "Can't resolve 'fs'" error when using node.js and wabpack?
Task: Need to get files from .
Code snippet written by me
var fs = require('fs');
let path = require('path');
module.exports = {
home: require('../components/Home.js'),
contact: require('../components/Contact.js'),
path: function(){
let p = path.resolve(__dirname,'./src/components');
fs.readdir( p, function(err, items) {
console.log(err);
console.log(items);
});
},
}
ERROR in ./src/core/registry.js
Module not found: Error: Can't resolve 'fs' in '/var/www/swylet.ru/src/core'
@ ./src/core/registry.js 1:9-22
@ ./src/core/router.js
@ ./src/core/boot.js
@ ./src/index.js
let path = require('path');
let config = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname,'./www/'),
filename: 'script.js'
},
devtool: "eval-sourcemap"
};
module.exports = (evn, options) => {
let mode = options.mode === 'production';
config.devtool = mode ? false : "eval-sourcemap";
return config
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question