这是我自学Vue-loader 和webpack上的问题 运行报错了

发布于 2022-09-04 14:41:52 字数 2589 浏览 9 评论 0

这是代码部分

module.exports={

entry:'./main.js',

output:{
    path:__dirname,
    filename:'build.js'
},
module:{
    loaders:[
        {test:/\.vue$/,loader:'vue'},
        {test:/\.js$/,loader:'babel',exclude:/node_modules/}
    ]
},
babel:{
    presets:['es2015'],
    plugins:['transform-runtime']
}

};

这是报错部分

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

  • configuration has an unknown property 'babel'. These properties are valid:
    object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, 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: {
       babel: ...
     }
   })
 ]

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "E:\Develop\Node\node.exe" "E:\Develop\Node\node_modules\npm\bin\npm-cli.js" "run" "dev"
npm ERR! node v7.7.1
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! Vue-loader-Demo@1.0.0 dev: webpack-dev-server --inline --hot
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Vue-loader-Demo@1.0.0 dev script 'webpack-dev-server --inline --hot'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Vue-loader-Demo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack-dev-server --inline --hot
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs Vue-loader-Demo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls Vue-loader-Demo
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! E:DevelopWebStromProjectVueVue-loader-Demonpm-debug.log

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

心头的小情儿 2022-09-11 14:41:52

你的webpack配置是webpack1的,但你现在安装了webpack2,请先卸载webpack2,再安装webpack1。

又或者是你找个webpack2版本的配置文件。

抚你发端 2022-09-11 14:41:52

babel配置有问题,应该为:
module: {
loaders: [

{
  test: /\.js$/,
  exclude: /(node_modules|bower_components)/,
  loader: 'babel-loader?presets[]=es2015'
}

]
}
或者
module: {
loaders: [

{
  test: /\.js$/,
  exclude: /(node_modules|bower_components)/,
  loader: 'babel-loader',
  query: {
    presets: ['es2015']
  }
}

]
}

握住我的手 2022-09-11 14:41:52

解决了吗?
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration has an unknown property 'Favlist'. These properties are valid:
    object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, 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: {
       Favlist: ...
     }
   })
 ]
  • configuration.resolve.extensions[0] should not be empty.

蹲在坟头点根烟 2022-09-11 14:41:52

请问楼主解决吗?我也是这个问题,到现在还没解决,能不能帮帮我,十分感谢

埋情葬爱 2022-09-11 14:41:52

我也遇到了同样的问题,请问楼主是怎么解决的?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文