我正在使用webpack + react + nodejs,这是我的webpack配置文件:
当我在浏览器上打开网站时,它返回Uncaught Error:在浏览器上找不到模块“fs”。
var webpack = require('webpack');
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: [
'script-loader!./public/js/vendor/jquery.js',
'script-loader!./public/js/vendor/foundation.min.js',
'script-loader!./public/js/app.js',
'./view/app.jsx',
'./view/styles/main.scss'
],
externals: {
jquery: 'jQuery'
},
plugins: [
new ExtractTextPlugin({
filename: './public/styles/bundle.css',
allChunks: true,
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
],
output: {
path: __dirname,
filename: './public/bundle.js'
},
resolve: {
alias: {
view: path.join(__dirname, 'view'),
componentDir: path.join(__dirname, 'view/components/'),
configureStore: path.resolve(__dirname, 'view/store/configureStore/'),
actions: path.resolve(__dirname, 'view/actions/index/')
},
extensions: ['.js', '.jsx']
},
module: {
rules: [
...
]
}
};
问题出在哪里?
答案 0 :(得分:2)