Skip to content

janhesters/riteway-swc-example

Repository files navigation

SWC RITEway Minimal Example

This is a minimal reproducable example for this StackOverflow question.

What Works

  • yarn test:identity - Simple test of plain JavaScript.
  • yarn test:no-absolute-import-and-react - This test shows relative imports work and that JSX works.
  • yarn dev - You can see that the absolute imports work when compiled by Next.js which also uses SWC by default. (We have no idea which config they use though, and how you'd use it with @swc-node/register.)

What We Want to Make Work

  • yarn test - This is the command that should ultimately work. It finds all files ending with .test.js within src/ and runs them. It fails because using absolute imports and importing .css files crashes the compilation. (The ultimate test is features/home/home-page-component.test.js.)
  • yarn test:css - Runs a test where .css is imported.
  • yarn test:absolute-import - Runs a test with an absolute import.
  • yarn test:watch - We added a watch script for your convenience, which runs whenever a .js file is saved. It fails because it runs yarn test but you can change that command :)

Thanks

Thank you sooo much for your help! 🙏

About

An example repo for StackOverflow.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published