webpack配置babel-loader时报错
来源:2-4 Webpack loader基础应用
人生导师_毛毛
2017-12-12
ERROR in ./client/App.jsx
Module build failed: SyntaxError: Unexpected character '(' (6:10)
4 |
5 | render () {
> 6 | return(
| ^
7 | <div>this is APP</div>
8 | )
9 | }
@ ./client/app.js 2:0-27
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! font-cto@1.0.0 build: `webpack --config build/webpack.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the font-cto@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/yangshasha/.npm/_logs/2017-12-12T02_10_36_472Z-debug.logbabel插件都安装了 但是依然提示语法错误
-----------------------------------------------------------------------------------------------------------------------
找到问题了!!!!
配置webpack.config.js时 plugins配置写错了 写成plugin了
错误代码
const path = require('path')
const HTMLPlugin = require('html-webpack-plugin')
module.exports = {
entry: {
app: path.join(__dirname, '../client/app.js')
},
output: {
filename: '[name].[hash].js',
path: path.join(__dirname, '../dist'),
publicPath: '/public'
},
module: {
rules: [
{
test: /.jsx$/,
loader: 'babel-loader'
}
]
},
plugin: [
new HTMLPlugin()
]
}最后面应该是
plugins: [ new HTMLPlugin() ]
写回答
1回答
-
人生导师_毛毛
提问者
2017-12-12
配置错了
10
相似问题