Webpack was initialized using a configuration object that does not match the API schema

advertisements

enter code herenpm test;

var webpackConfig = require('./webpack.test');
module.exports = function(config) {
  config.set({

    basePath: '',

    frameworks: ['jasmine'],

    files: [
      {pattern: './karma-shim.js', watched: false}

    ],

    exclude: [
    ],

    preprocessors: {
      './karma-shim.js': ['webpack']
    },

   webpack: webpackConfig,
    plugins:[
      'karma-jasmine',
      'karma-chrome-launcher',
      require("karma-webpack")
    ],
    proxies:{
      "/app/": "http://localhost:3000/src/app"
    },

    reporters: ['progress'],

    port: 9876,

    colors: true,

    logLevel: config.LOG_INFO,

    autoWatch: true,

    browsers: ['Chrome'],

    singleRun: false,

    concurrency: Infinity
  })
}
module.exports = {
  devtool: 'cheap-module-eval-source-map',
  resolve: {
    extensions: ['','.ts','.js']
  },

  module: {
    loaders: [
      //以.ts结尾的文件使用 TypeScript loader
      {test: /.ts$/,loader: 'awesome-typescript-loader'},
      {
        test:/\.html$/,
        loader: 'html'
      },
      {
        test:/\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
        loader: 'null'
      },
      {
        test:/\.css$/,
        loader: 'null'
      }
    ]
  }
}

then throws a BUG.

karma start karma.conf.js

keywords if/then/else require v5 option WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.entry should be one of these: object { : string | [string] } | string | [string] The entry point(s) of the compilation. - configuration.resolve.extensions[0] should not be empty.

Can not load "webpack"!


First i don't see any entey point mentioned in config file which is required in order to webpack understand where to start from.

Second your resolve option in config file hase mentioned three types to resolve and first one is empty string which webpack don't like so by removing that empty string it should fix that problem

Hope this help you to fix the issue.