「wds」:配置对象无效。 Webpack已使用与API架构不匹配的配置对象进行初始化

问题描述 投票:2回答:1

我一直试图找到一种方法来分类/探索我的计算机上的数百万鼓声音乐制作,并遇到this project和克隆this github

运行npm start后,我得到Invalid configuration object错误。完整日志:

User-2:aiexperiments-drum-machine-master User$ npm start

> [email protected] start /Users/User/Dropbox/aiexperiments-drum-machine-master
> webpack-dev-server

✖ 「wds」: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.module has an unknown property 'loaders'. These properties are valid:
   object { defaultRules?, exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, strictExportPresence?, strictThisContextOnImports?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp? }
   -> Options affecting the normal modules (`NormalModuleFactory`).
 - configuration.resolve has an unknown property 'modulesDirectories'. These properties are valid:
   object { alias?, aliasFields?, cachePredicate?, cacheWithContext?, concord?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }
   -> Options for the resolver
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
javascript node.js webpack frontend webpack-dev-server
1个回答
0
投票

webpack.config.js格式不正确并使用the docs中不存在的非标准密钥。我已经纠正了错误 - 用以下内容替换你的webpack.config.js

/**
 * Copyright 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var webpack = require("webpack");

var PROD = JSON.parse(process.env.PROD_ENV || '0');

module.exports = {
    "context": __dirname,
    entry: {
        "Main": "app/Main",
    },
    output: {
        filename: "./build/[name].js",
        chunkFilename: "./build/[id].js",
        sourceMapFilename : "[file].map",
    },
    resolve: {
        modules: [
            "node_modules", 
            "node_modules/tone", 
            "app"
        ],
    },
    plugins: PROD ? [
        new webpack.optimize.UglifyJsPlugin({minimize: true}),
        new webpack.DefinePlugin({__DEV__: true})   
    ] : [],
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: [/node_modules/],
                loader: 'jshint-loader'
            },
            {
                test: /\.scss$/,
                loader: "style!css!autoprefixer!sass"
            },
            {
                test: /\.json$/,
                loader: "json-loader"
            },
            {
                test: /\.(png|gif)$/,
                loader: "url-loader",
            },
            {
                test   : /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
                loader : "file-loader?name=images/font/[hash].[ext]"
            }
        ]
    },
    watch: true

};
© www.soinside.com 2019 - 2024. All rights reserved.