chai.js stopped working with webpack1 out of the box

Created on 1 Jun 2017  路  5Comments  路  Source: chaijs/chai

Due to commit 4d45c5db6ed0518d7d8227f024590a4ec5983384, chai.js now requires json-loader, which is not included in Webpack 1.

Webpack 2 has a built-in json loader, so it is not affected.

Workarounds: user can manually add json-loader to his webpack 1 configuration, or use webpack 2.

Most helpful comment

Thank you for addressing this. 馃憤 I'll verify (and close the ticket) once 4.0.2 is out.

All 5 comments

That's a breaking change. I had to add:

          {
            test: /\.json$/,
            loader: 'json-loader',
          },

and

-extensions: ['.js'],
+extensions: ['.js', '.json'],

Hey @AviVahl, thanks for your issue
I believe that this should be fixed once #986 gets merged and published
Let me know if I'm missing something

Thank you for addressing this. 馃憤 I'll verify (and close the ticket) once 4.0.2 is out.

In chai.js the line exports.version = require('../package').version; is DRY, but it is brittle with regard to webpack and also wallabyjs.

In order to get things working with wallaby any override of webpackConfig.resolve.extensions needs to include .json. This is an extension of the modification suggested by @oliviertassinari.

Closed via https://github.com/chaijs/chai/pull/986. We'll get a release out soon.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

meeber picture meeber  路  4Comments

domenic picture domenic  路  4Comments

corybill picture corybill  路  4Comments

meeber picture meeber  路  3Comments

xareelee picture xareelee  路  3Comments