webpack模块解析失败:意外字符'...'(1:0]

时间:2019-05-24 12:16:47

标签: webpack

我有一个非常简单的项目,以仅一个js文件作为入口点来测试webpack的新版本,但是,每当我在本地运行npx webpacknpm run build进行捆绑时,都会出现此错误:

ERROR in ./src/app.js 1:0
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type.

package.json:

{
  "name": "webpacktut",
  "version": "1.0.0",
  "description": "",
  "main": "webpack.config.js",
  "scripts": {
    "build": "webpack --config webpack.config.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {},
  "devDependencies": {
    "webpack": "^4.32.2",
    "webpack-cli": "^3.3.2"
  }
}

webpack.config.js

 var path = require('path');

 module.exports = {
    entry: {
      App:  "./src/app.js"
    },
    output: {
      path: path.resolve(__dirname, "dist"),
      filename: "app-fin.js"
    }
};

有人可以告诉我哪里出了问题吗?

0 个答案:

没有答案