【问题标题】:babel & karma & webpack not workingbabel & karma & webpack 不工作
【发布时间】:2015-07-14 16:30:17
【问题描述】:

我在 webpack 中使用 babel,并使用 karma 和 jasmine 进行测试。 为了使用Set()(需要polyfill),我添加了:

loader: 'babel-loader?optional[]=runtime'

到配置。

这项工作非常适合应用程序本身,但测试不起作用,抛出:

TypeError: 'undefined' is not an object (evaluating '_core.Object')

【问题讨论】:

    标签: karma-runner webpack babeljs


    【解决方案1】:

    好的,我自己解决了:

    1. 删除?optional[]=runtime'

    2. 添加到配置:

    `

    files: [
                'node_modules/babel-core/browser-polyfill.js',
          ... (rest of the needed files) 
        ],
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-04
      • 1970-01-01
      • 2016-02-28
      • 1970-01-01
      • 2017-01-01
      • 1970-01-01
      • 2016-06-02
      • 2018-11-03
      相关资源
      最近更新 更多