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

Docs: Add useSWC documentation as alternative to Babel #22861

Merged
merged 2 commits into from
Jun 7, 2023

Conversation

jonniebigodes
Copy link
Contributor

@jonniebigodes jonniebigodes commented May 31, 2023

With this pull request, the documentation was updated to feature the experimental flag useSwc as an alternative to Babel.

Follows up on #22075 and addresses #22678

What was done:

  • Updated the documentation to feature in the feature flag and reference it as a fallback for issues with Babel
  • Created the required snippets

Leaving out the patch label to avoid issues with the documentation being published, as it seems that this flag is only available for 7.1.

@jonniebigodes
Copy link
Contributor Author

Thanks for taking the time to review this @ndelangen. Appreciate it 🙏 . Merging

@jonniebigodes jonniebigodes merged commit a6f4de3 into next Jun 7, 2023
@jonniebigodes jonniebigodes deleted the chore_add_swc_feature_flag branch June 7, 2023 13:00
@kylegach kylegach mentioned this pull request Jun 8, 2023
5 tasks
@JReinhold JReinhold changed the title Chore: (Docs) Adds useSWC documentation as alternative to Babel Docs: Add useSWC documentation as alternative to Babel Jun 9, 2023
@benedfit
Copy link

benedfit commented Oct 9, 2023

Am I right in assuming there is currently no way to provide additional config to swc-loader in the same way as is possible with babel-loader? I'm currently using a non-standard swc.config.js file, rather than .swcrc, (due to the needs of a plugin), so I don't have a means of passing this config to Storybook

@ndelangen
Copy link
Member

AFAICS plugins can be used in .swcrc: https://swc.rs/docs/configuration/compilation#jscexperimentalplugins

We could add a way to explicitly configure the swc-loader via main.ts for sure, though if not needed, I'd rather not.
I can't find a config option in their docs to set the configFile to a custom path for the swc-loader: https://swc.rs/docs/usage/swc-loader

@benedfit
Copy link

benedfit commented Oct 9, 2023

@swc/plugin-relay currently needs rootDir: __dirname and as a result the config can't be in the usual JSON format. So everywhere I'm using swc-loader I'm explicitly passing in the contents of my config file. e.g.

const swcConfig = require("./.swcrc.js")

// ...

{
  include: path.resolve("./src"),
  test: /\.ts$/,
  use: [
    {
      loader: "swc-loader",
      options: swcConfig,
    },
  ],
}

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

Successfully merging this pull request may close these issues.

3 participants