请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

webpack时候出错

https://img1.sycdn.imooc.com/szimg//599d7b89000113f109950459.jpg问题补充(选填):请详细描述你的问题,贴出相关代码或截图,并告知你的操作步骤

正在回答 回答被采纳积分+3

2回答

提问者 qq_谜离_03319966 2017-08-24 10:12:05

index.js↓

var React = require('react');
var ReactDOM = require('react-dom');

ReactDOM.render(
  <h1>Hello World!</h1>,
  document.getElementById('example')
);

webpack.config.js↓

var webpack = require('webpack');
var path = require('path');
module.exports={
  context: __dirname+'/src',
  entry:"./js/index.js",
  mondule:{
     loaders:[{
        test:/\.js?$/,
        exclude:/(node_modules)/,
        loader:'babel-loader',
        query:{
           presets:['react','es2015']
        }
     }]
  },
  output: {
     path: __dirname+"/src/",
     filename: "bundle.js"
  }
};

package.json↓

{
 "name": "react01",
 "version": "1.0.0",
 "description": "",
 "main": "index.js",
 "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1"
 },
 "author": "",
 "license": "ISC",
 "dependencies": {
   "babel-preset-es2015": "^6.24.1",
   "babel-preset-react": "^6.24.1",
   "babelify": "^7.3.0",
   "create-react-app": "^1.4.0",
   "react": "^15.6.1",
   "react-dom": "^15.6.1",
   "webpack": "^3.5.5",
   "webpack-dev-server": "^2.7.1"
 }
}

代码我是找着敲的 不过 编辑器我用的是webstorm

在命令行执行webpack的时候 报错

下面是报错信息

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

 - configuration has an unknown property 'mondule'. These properties are valid:

   object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }

   For typos: please correct them.

   For loader options: webpack 2 no longer allows custom properties in configuration.

     Loaders should be updated to allow passing options via loader options in module.rules.

     Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:

     plugins: [

       new webpack.LoaderOptionsPlugin({

         // test: /\.xxx$/, // may apply this only for some modules

         options: {

           mondule: ...

         }

       })

     ]


0 回复 有任何疑惑可以回复我~
Parry 2017-08-23 21:00:01

你这样提问我猜不出你的问题,请提供部分代码。

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信