小编Ind*_*lai的帖子

webpack中的配置对象无效

我正在关注Lynda.com - Eve Porcello的React.js基本训练.在视频"使用Webpack构建"中,我完全按照作者描述的步骤操作,但"webpack"命令未能给出以下错误,

配置对象无效.Webpack已使用与API架构不匹配的配置对象进行初始化. - configuration.output.path:提供的值"dist/assets"不是绝对路径!

以下是我的webpack.config.js和package.json文件.

webpack.config.js

var webpack = require("webpack");

module.exports = {
  entry: "./src/index.js",
  output: {
    path: "dist/assets",
    filename: "bundle.js",
    publicPath: "assets"
  },
  devServer: {
    inline: true,
    contentBase: "./dist",
    port: 3000
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /(node_modules)/,
        loader: "babel-loader",
        query: {
          presets: ["latest", "stage-0", "react"]
        }
      }
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

的package.json

{
  "name": "react-essential",
  "version": "1.0.0",
  "description": "A project focusing on React and related tools",
  "main": "index.js",
  "scripts": { …
Run Code Online (Sandbox Code Playgroud)

javascript json npm reactjs webpack

15
推荐指数
3
解决办法
2万
查看次数

标签 统计

javascript ×1

json ×1

npm ×1

reactjs ×1

webpack ×1