Javascript 模块分析失败:意外的令牌错误
我有这个应用程序,即时通讯建设 香草js和引导 webpack.config.jsJavascript 模块分析失败:意外的令牌错误,javascript,web,webpack,Javascript,Web,Webpack,我有这个应用程序,即时通讯建设 香草js和引导 webpack.config.js const path = require('path') module.exports ={ entry: './src/index.js', output: { filename: 'main.js', path: path.resolve(__dirname, 'dist'), } }; package.json { "name": "todo
const path = require('path')
module.exports ={
entry: './src/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
}
};
package.json
{
"name": "todolist",
"version": "1.0.0",
"description": "",
"private": true,
"main": "main.js",
"dependencies": {
"bootstrap": "^4.4.1"
},
"devDependencies": {
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
我得到了这个错误:
ERROR in ./src/index.js 28:26
Module parse failed: Unexpected token (28:26)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
|
> static changeActivity = () =>{
| activityPage.addEventListener('click', (e) =>{
| e.preventDefault();
即使我删除了这些行,webpack似乎仍停留在那里。您需要babel loader来传输您的代码:我同时做了,但是如果您知道,我如何启用classProperties呢?:D