-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Parcel 2: @parcel/register
node require hook
#2396
Comments
Is this available? For example, if you're using Jest, is it possible to use Parcel to transform the TypeScript? |
This seems important, and I'm interested as well. In the process of converting a CRA react and node backend, and got as far as trying to run my Jest tests through parcel and ended up here. How do I tell which version of swc a given parcel version is using? I'm on 2.2.1. |
I had started on it here. Haven't had time to work on it recently. Feel free to take a look if you want! https://github.com/parcel-bundler/parcel/compare/parcel-node |
Without this, should there be a disclaimer that parcel doesn't support unit testing? One of the key features of parcel is the transformer pipeline, which is unsupported. |
@devongovett Any movement on this from you? Thoughts on starting with getting the new transform and resolve functions you have added to Parcel? I can see the |
The idea here is to enable Parcel transformers and resolvers to be run in other places than just bundling via a package similar to
babel-register
or other require hooks in node. This way, you could run the same Parcel transformers that you run when bundling your app in your tests, which might run in node.Currently it is very challenging to set up a real world app, even with Parcel, because you are still stuck configuring other tools like mocha, jest, babel, and others for your tests, not even your real app. If you could get the same zero configuration experience just by loading
@parcel/require
in node, that would be pretty great.There are a bunch of Parcel features that would be great to be able to use in tests:
source
andalias
fields in package.json. No manually configuringbabel-register
to include certain node_modules. Using the Parcel resolver, this would be possible.babel-register
might not be enough if you are using other compilers. We could even automatically handle things like CSS imports that won't work in node.@parcel/register
would only run the Parcel transformer pipeline, not any packagers or actual bundling. It would operate on a per-file level, and hook into the node module system to compile and resolve modules.The text was updated successfully, but these errors were encountered: