Open AlexanderOtavka opened 8 years ago
I have the same problem. It took me half a day to pin-point it 😢 For a quick ~fix I've used grunt-iife instead (and it's a bit better for my case).
I had the same problem. You can work around it by using passPerPreset
to run iife-wrap
before the es2015
transforms:
{
passPerPreset: true,
presets: [
{
plugins: ['babel-plugin-iife-wrap'],
},
'babel-preset-es2015',
],
}
I don't have enough time to maintain this project, but I can accept pull request if you are interested in this plugin.
@rluba Thanks for the solution. It worked for me.
For those searching on the Google in the future, the error message I was seeing is:
TypeError: _typeof is not a function
In case it's useful to anyone: you can implement the equivalent transform in a karma preprocessor very easily with karma-generic-preprocessor, something like this:
preprocessors : {
'**/*.js': ['generic', /* other preprocessors here */ ],
},
genericPreprocessor: {
rules: [
// This is the equivalent of what gulp-iife does outside of the tests
{
process: function(content, file, done, log) {
file.path = file.originalPath.replace(/\.js$/g, '.iife.js');
done(`(function() {\n'use strict';\n${content}\n})();`);
},
},
],
},
I made a gist to demonstrate: https://gist.github.com/AlexanderOtavka/698b83a1ffab9b2141d01b6cd25753c7