Webpack was initialized using a config object that doesn't match the API schema

enter the 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
  })
}
      

Run codeHide result


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'
      }
    ]
  }
}
      

Run codeHide result


then throws a BUG error.

karma start karma.conf.js

keywords if / then / else requires v5 option WebpackOptionsValidationError: Invalid config object. Webpack was initialized using a config object that doesn't match the API schema. - configuration.entry must be one of the following: object {: string | [string]} | string | [String] Compilation entry point (s). - configuration.resolve.extensions [0] must not be empty.

Unable to load "webpack"!

+3


source to share


2 answers


Firstly, I don't see any entey point mentioned in the config file, which is required for webpack to figure out where to start.

Second, your permission setting in your hase config file mentioned three types for permission, and the first is an empty line which webpack doesn't like, removing that empty line should fix this issue.



Hope this helps you solve the problem.

0


source


I had the same problem and resolved by updating the package karma-webpack

to the latest version.



0


source







All Articles