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

Webpack loader #2

Open
lucasconstantino opened this issue Oct 28, 2016 · 5 comments
Open

Webpack loader #2

lucasconstantino opened this issue Oct 28, 2016 · 5 comments

Comments

@lucasconstantino
Copy link

Here goes a simple webpack loader: https://github.com/lucasconstantino/identity-object-proxy-loader

@keyz
Copy link
Owner

keyz commented Oct 30, 2016

Hey, thanks for making this! Just curious, what are your use cases for this as a webpack loader?

@lucasconstantino
Copy link
Author

lucasconstantino commented Oct 31, 2016

When using Jest, you always have to fix a bunch of stuff Webpack takes care of; aliases, loaders, etc. It's very easy to use identity-obj-proxy directly as a mock for some kind of files such as .css, but you always get stuck with something else Webpack is doing which is hard to replicate on Jest. Therefore, sometimes it's easier to have a specific webpack file just for running tests, something that extends the default webpack configuration for you app. In this case, I'll use this loader to address .css files while testing.

Did it make sense?

@keyz
Copy link
Owner

keyz commented Nov 1, 2016

Thanks. We just replaced Jest's scriptPreprocessor config with transform (jestjs/jest#1917), which is a mapping from extensions to transformer scripts. There's an example usage at jestjs/jest#2035. It might fit your needs better -- let me know what you think!

@lucasconstantino
Copy link
Author

Hey, that's really cool! You guys are improving :) For sure this will fit most of my use cases. Anyway, I think there are still parts of Webpack that simply shouldn't be handled by Jest or any other tool. I mean, I can never really guarantee things will get done the same way by the both of them, Jest and Webpack.

Thanks for all the reply!

@keyz
Copy link
Owner

keyz commented Nov 1, 2016

Thanks, let's keep this issue open for visibility.

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

2 participants