Below is my webpack.config.js. In the browser developer tools, getting "Uncaught ReferenceError: require is not defined"
If I remove "target":"node", then error "Uncaught TypeError: fs.readFileSync is not a function" is thrown.
var config = {
entry: './main.js',
output: {
filename: './index.js',
},
devServer: {
inline: true,
port: 8080
},
node: {
fs: "empty"
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react']
}
}
]
},
target: 'node'
}
module.exports = config;