mock-css-modules icon indicating copy to clipboard operation
mock-css-modules copied to clipboard

It doesn't work with transpiled imports

Open andrei-cacio opened this issue 9 years ago • 1 comments

Hi, I am using Ava to run my tests.

I don't know what I am doing wrong but this should work:

import mockCSS from 'mock-css-modules';
mockCSS.register(['.scss', '.css']);

import '../some-style.scss';

throws an error

however if I rewrite it using commonjs require

import mockCSS from 'mock-css-modules';
mockCSS.register(['.scss', '.css']);

require('../some-style.scss');

it works.

Babel should transpire all imports into requires. I don't really know why this doesn't work.

andrei-cacio avatar Dec 08 '16 07:12 andrei-cacio

I'm unfamiliar with Ava. What error do you get with the import? Could you create a minimal project that exhibits this behavior?

bmatcuk avatar Dec 08 '16 17:12 bmatcuk