我有一个非常简单的项目,以仅一个js文件作为入口点来测试webpack
的新版本,但是,每当我在本地运行npx webpack
或npm 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"
}
};
有人可以告诉我哪里出了问题吗?