为了账号安全,请及时绑定邮箱和手机立即绑定

设置 webpack.config.js文件错误

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

 - configuration.module has an unknown property 'loader'. 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 'extentions'. 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

    at webpack (F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\webpack\lib\webpack.js:31:9)

    at Stream.<anonymous> (F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\webpack-stream\index.js:148:38)

    at _end (F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\through\index.js:65:9)

    at Stream.stream.end (F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\through\index.js:74:5)

    at module.exports (F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\webpack-stream\index.js:227:12)

    at Gulp.gulp.task (F:\qianduan_dir\00program\JQuery\shudu\src\gulpfile.js:8:11)

    at module.exports (F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\orchestrator\lib\runTask.js:34:7)

    at Gulp.Orchestrator._runTask (F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\orchestrator\index.js:273:3)

    at Gulp.Orchestrator._runStep (F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\orchestrator\index.js:214:10)

    at Gulp.Orchestrator.start (F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\orchestrator\index.js:134:8)


正在回答

3 回答

https://gitee.com/jamesfancy/sudoku

这里有更新过的代码可以参考

0 回复 有任何疑惑可以回复我~

发现问题了,这个视频是webpack 2.5 之前的,现在webpack 使用不能这样用,需要更新,但是不知道这个视频的应该如何更新,更新成下面这样,报错,求解现在应该如何写呢

更新如下:

module.exports = {

  entry: {

     index: './js/index'

  },

  output: {

      filename: '[name].js' 

  },

  devtool: 'source-map',

    resolve: {

        extensions: ['.js'] 

    },

    module: {

        rules: [{

            test: /\.js$/, 

            exclude: /node_modules/, 

            use: [{

                loader: 'babel', 

                options: {

                    presets: ['es2015'] ////按照最新的 ES6 语法规则去转换

                }

            }]

        }]

    }

}


错误如下:

internal/streams/legacy.js:59

      throw er; // Unhandled stream error in pipe.

      ^

Error: Entry module not found: Error: Can't resolve 'babel' in 'F:\qianduan_dir\00program\JQuery\shudu\src'

BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.

                 You need to specify 'babel-loader' instead of 'babel',

                 see https://webpack.js.org/migrate/3/#automatic-loader-module-name-extension-removed

resolve 'babel' in 'F:\qianduan_dir\00program\JQuery\shudu\src'

  Parsed request is a module

  using description file: F:\qianduan_dir\00program\JQuery\shudu\src\package.json (relative path: .)

    resolve as module

      F:\qianduan_dir\00program\JQuery\shudu\node_modules doesn't exist or is not a directory

      F:\qianduan_dir\00program\JQuery\node_modules doesn't exist or is not a directory

      F:\qianduan_dir\00program\node_modules doesn't exist or is not a directory

      F:\node_modules doesn't exist or is not a directory

      looking for modules in F:\qianduan_dir\node_modules

        No description file found

      looking for modules in F:\qianduan_dir\00program\JQuery\shudu\src\node_modules

        using description file: F:\qianduan_dir\00program\JQuery\shudu\src\package.json (relative path: ./node_modules)

          using description file: F:\qianduan_dir\00program\JQuery\shudu\src\package.json (relative path: ./node_modules/babel)

            no extension

              F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\babel doesn't exist

        No description file found

            .js

              F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\babel.js doesn't exist

        no extension

          F:\qianduan_dir\node_modules\babel doesn't exist

            .json

              F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\babel.json doesn't exist

        .js

          F:\qianduan_dir\node_modules\babel.js doesn't exist

            as directory

              F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\babel doesn't exist

        .json

          F:\qianduan_dir\node_modules\babel.json doesn't exist

        as directory

          F:\qianduan_dir\node_modules\babel doesn't exist


0 回复 有任何疑惑可以回复我~

现在是需要使用 options 了么?

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

设置 webpack.config.js文件错误

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信