Unverified Commit 3b725453 authored by Jan Nicklas's avatar Jan Nicklas Committed by GitHub

resolve swc-plugin paths (#37412)



This PR uses `require.resolve` to allow using node module paths as SWC plugin names similar to Babel.
This works for:
- absolute file paths
- node modules
- node module paths

## Bug

- [x] Related issues: fixes #37409
parent ad728f4e
......@@ -43,6 +43,9 @@ function getBaseSWCOptions({
const useDefineForClassFields = Boolean(
jsConfig?.compilerOptions?.useDefineForClassFields
)
const plugins = (nextConfig?.experimental?.swcPlugins ?? [])
.filter(Array.isArray)
.map(([name, options]) => [require.resolve(name), options])
return {
jsc: {
...(resolvedBaseUrl && paths
......@@ -55,7 +58,7 @@ function getBaseSWCOptions({
parser: parserConfig,
experimental: {
keepImportAssertions: true,
plugins: nextConfig?.experimental?.swcPlugins ?? undefined,
plugins,
},
transform: {
// Enables https://github.com/swc-project/swc/blob/0359deb4841be743d73db4536d4a22ac797d7f65/crates/swc_ecma_ext_transforms/src/jest.rs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment