Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module parse failed: You may need an appropriate loader to handle this file type. #9

Closed
mkropat opened this issue Oct 11, 2018 · 3 comments

Comments

@mkropat
Copy link

mkropat commented Oct 11, 2018

I tried to get enzyme-extensions running with a Jasmine/Karma/Webpack setup and got this error:

webpack: Compiling...

ERROR in ./node_modules/@commercetools/enzyme-extensions/src/until/until.js
Module parse failed: Unexpected token (4:4)
You may need an appropriate loader to handle this file type.
|   const defaultedOptions = {
|     maxDepth: null,
|     ...options,
|   };
|

It appears that enzyme-extensions does not transpile its code before publishing to npm. This generally goes against the convention of npm. I tried this workaround which I'm sure would work for my situation, but I couldn't get it working in the 2 minutes I tried.

The way my test build is set up is that Karma runs Webpack to build the app + test code, then the built bundle is returned to Karma which starts up ChromeHeadless and uses Jasmine to execute the tests in the bundle. This probably isn't the only way to set it up, but I'm sure I'm also not alone in setting up my tests this way.

My understanding is that the typical Jest setup works differently, so I'm assuming the use of the spread operator is a non-issue for those setups.

Anyway, cool module. I probably won't spend any more time on it, so feel free to close this issue. I just wanted to give feedback that the way the module works now could cause issues with non-Jest setups.

@tdeekens
Copy link
Contributor

Thanks for the feedback! We use it in a setup in which we transpile. Yes, it's true it's against best practices. We can think or transpiling or just removing features which likely need it.

@dferber90
Copy link
Contributor

dferber90 commented Oct 11, 2018

Thanks for the heads-up! I opened enzymejs/enzyme#1863 today which adds renderProp to enzyme itself. The features will get transpiled there.

I wouldn't do anything for now and see whether renderProp makes it in. If it does, we will drop it in the next release and you should be able to use the library. If it doesn't, we can always remove the rest params & spread used in this package's renderProp.

@dferber90
Copy link
Contributor

Now that enzymejs/enzyme#1863 made it in, I'd close this issue. We'll deprecate/drop renderProp in this package and recommend to use the one from enzyme itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants