ERROR in Entry module not found: Error: Can't resolve './src' in 'C:\Users\土豆\Desktop\webpack-study'

问题:ERROR in Entry module not found: Error: Can’t resolve ‘./src’ in ‘C:\Users\土豆\Desktop\webpack-study’

如图ERROR in Entry module not found: Error: Can't resolve './src' in 'C:\Users\土豆\Desktop\webpack-study'_第1张图片

解决

var path = require('path');


module.exports = {
    entry: path.join(__dirname, './src/main.js'),
    //注意路径别写错
    output: {
        path: path.join(__dirname, './dist'),
        filename: 'bundle.js'
      }
  };

注意如图

  • webpack.config.js的目录是在根目录下,放到src目录下肯定会报错
    ERROR in Entry module not found: Error: Can't resolve './src' in 'C:\Users\土豆\Desktop\webpack-study'_第2张图片

你可能感兴趣的:(前端)