### `@swc/plugin-relay` `@swc/plugin-relay` compiles Relay GraphQL `graphql` tagged template literals into the corresponding Relay-generated artifact imports. It is the SWC equivalent of `babel-plugin-relay`, enabling projects that use the Relay framework to leverage SWC for faster compilation. #### Setup ```sh npm install --save-dev @swc/plugin-relay @swc/core ``` ### Example The below shows how to configure `@swc/plugin-relay` and pass the options to Webpack: Create an `.swcrc.js` file like the below: ```js // .swcrc.js module.exports = { jsc: { experimental: { plugins: [ [ "@swc/plugin-relay", { rootDir: __dirname, artifactDirectory: "src/__generated__", language: "typescript", eagerEsModules: true, }, ], // Or if you want to use multiple projects [ "@swc/plugin-relay", { projects: [ { rootDir: path.resolve(__dirname, '../project1'), }, { rootDir: path.resolve(__dirname, '../project2'), } ], language: "typescript", eagerEsModules: true, }, ], ], }, parser: { syntax: "typescript", tsx: true, }, transform: { react: { runtime: "automatic", }, }, }, }; ``` And then update your `swc-loader` Webpack config: ```js const swcConfig = require("./.swcrc.js") // ... { include: path.resolve("./src"), test: /\.ts$/, use: [ { loader: "swc-loader", options: swcConfig, }, ], } ``` > Note: We're using a `.swcrc.js` file extension up above and importing the config directly because Relay needs access to `__dirname`, which can't be derived from the default JSON parsed from `.swcrc`. #### Output import paths By default, `@swc/plugin-relay` will transpile import paths based on the `language` option. You can use `outputFileExtension` to change the file extension of the generated import paths. ```js plugins: [ [ "@swc/plugin-relay", { rootDir: __dirname, artifactDirectory: "src/__generated__", language: "typescript", eagerEsModules: true, outputFileExtension: "js", }, ], ], ``` In this example typescript graphql files will output transpiled import path of `javascript` ending with `.js`. # @swc/plugin-relay ## 18.0.2 ### Patch Changes - ea2665b: Update swc_core to 84.0.1. ## 18.0.1 ### Patch Changes - Update swc_core to 83.0.0. ## 18.0.0 ### Major Changes - 1fa243d: Update swc_core to 82.2.0. ## 17.0.0 ### Major Changes - 5c6d86d: Update swc_core to 82.0.0. ## 16.0.0 ### Major Changes - e995ea5: build!: Update swc_core to v81.0.2 ## 15.0.0 ### Major Changes - d90fa6c: build!: Update swc_core to v81.0.0 ## 14.0.0 ### Major Changes - a9a7fe9: build!: Update swc_core to v78.0.0 ## 13.0.0 ### Major Changes - 74931df: build!: Update swc_core to v77.0.0 ## 12.19.0 ### Minor Changes - 8d2db7f: build: Update swc_core to v76.0.0 ## 12.18.0 ### Minor Changes - 1a6fdee: build: Update swc_core to v75.0.0 ## 12.17.0 ### Minor Changes - 6051cea: build: Update swc_core to v74.0.0 ## 12.16.0 ### Minor Changes - b7be81b: build: Update swc_core to v73.0.0 ## 12.15.0 ### Minor Changes - 4b382e7: build: Update swc_core to v72.0.0 ## 12.14.1 ### Patch Changes - e785517: build: Update swc_core to v71.0.5 ## 12.14.0 ### Minor Changes - 7cc5e96: build: Update swc_core to v72 ## 12.13.0 ### Minor Changes - c3013d7: build: Update swc_core to v69 ## 12.12.0 ### Minor Changes - 3b04284: build: Update swc_core to v68 ## 12.11.0 ### Minor Changes - 3b4d5b9: build: Update swc_core to v67 ## 12.10.0 ### Minor Changes - 5e967fc: build: Update swc_core to v66.0.3 ## 12.9.0 ### Minor Changes - d2f9cfa: build: Update swc_core to v65.0.0 ## 12.8.0 ### Minor Changes - a0fb975: Update swc_core to v61.0.1 ## 12.7.0 ### Minor Changes - 1cbeb5a: build: Update swc_core to v58.0.1 ## 12.6.0 ### Minor Changes - 2113ddb: build: Update swc_core to v57 ## 12.5.0 ### Minor Changes - 870774a: build: Update swc_core to v56 ## 12.4.0 ### Minor Changes - 66f5258: build: Update swc_core to v55.x.x ## 12.3.0 ### Minor Changes - 9c163ec: Update swc_core to v53, really ## 12.2.0 ### Minor Changes - 3799fa4: Update swc_core to v53.0.0 ## 12.1.0 ### Minor Changes - 0a1d66f: Update swc_core to v52.0.0 ## 12.0.1 ### Patch Changes - a73246f: build: Update swc_core to v49.0.0 ## 12.0.0 ### Major Changes - 6c46f86: feat: Enable backward-compatibility feature ## 11.1.1 ### Patch Changes - 255528d: Fix typo in config types - ad79e09: Update swc_core to v48.0.4 ## 11.1.0 ### Minor Changes - 7a0fbdb: Update swc_core to v48 ## 11.0.0 ### Major Changes - 593f438: Update swc_core to v47 ## 10.0.0 ### Major Changes - 25e0c2c: Update swc_core to v46.0.0 ## 9.5.0 ### Minor Changes - c324a59: Update swc_core to v45 ## 9.4.0 ### Minor Changes - 8bad98d: Update swc_core to v44 ## 9.3.0 ### Minor Changes - 47be132: Update swc_core to v42 ## 9.2.0 ### Minor Changes - 0c9d7a1: build: Update swc_core to v39.0.0 ## 9.1.0 ### Minor Changes - a872100: build: Update swc_core to v38 ## 9.0.3 ### Patch Changes - 9cdcdc5: Update swc_core to v36 ## 9.0.2 ### Patch Changes - 9b08ff7: Update swc_core to v35 ## 9.0.1 ### Patch Changes - df280ad: Update swc_core to v34.0.0 ## 9.0.0 ### Major Changes - 562e755: Update swc_core to v33 ## 8.0.4 ### Patch Changes - 85719ca: Update swc_core to v32 ## 8.0.3 ### Patch Changes - 45d1ac7: Update swc_core to v31 ## 8.0.2 ### Patch Changes - 54febbc: Update swc_core to v29 ## 8.0.1 ### Patch Changes - 8d5ce5c: Update swc_core to v28.0.0 ## 8.0.0 ### Major Changes - cf2636b: Update swc_core to v27 ## 7.0.5 ### Patch Changes - e3e743d: Update swc_core to v27 ## 7.0.4 ### Patch Changes - 5ddbaeb: Update swc_core to v23 ## 7.0.3 ### Patch Changes - d51d525: Update swc_core to v22.0.0 ## 7.0.2 ### Patch Changes - cb94b92: Update swc_core to v21.0.1 ## 7.0.1 ### Patch Changes - 31e3254: build: Update `swc_core` to `v19.0.0` ## 7.0.0 ### Major Changes - f0fee1d: Update swc_core to v15.0.1 ## 6.3.2 ### Patch Changes - 04465bc: Update swc_core to v14.0.0, really ## 6.3.1 ### Patch Changes - ce8d317: Update swc_core to v14.0.0 ## 6.3.0 ### Minor Changes - bfa0a51: Update swc_core to v13 ## 6.2.0 ### Minor Changes - b8c4e6c: Update swc_core to v12 ## 6.1.0 ### Minor Changes - 4c8b0e2: Update swc_core ## 6.0.4 ### Patch Changes - e8973e8: Update swc_core to v10.2.3 ## 6.0.3 ### Patch Changes - f436a09: Update swc_core to v10. ## 6.0.2 ### Patch Changes - f155bce: Update swc_core to v9 ## 6.0.1 ### Patch Changes - c9e75ce: Bump crate versions ## 6.0.0 ### Major Changes - 4574a70: Update swc_core to v8.0.1 ## 5.0.3 ### Patch Changes - f3cea5f: Bump versions ## 5.0.2 ### Patch Changes - a73664c: Update swc_core to v6.0.2 ## 5.0.1 ### Patch Changes - 4ff3b22: Move formatjs plugin to official plugin repository ## 5.0.0 ### Major Changes - 4ad7f56: Update swc_core to v5 ## 4.0.0 ### Major Changes - ba13397: Update swc_core to v4 ## 3.0.4 ### Patch Changes - 0508b6d: Update swc_core to v3 ## 3.0.3 ### Patch Changes - cd5ad2a: Update swc_core to 1.0 ## 3.0.2 ### Patch Changes - 20162c8: Update swc_core to v0.106.0 ## 3.0.1 ### Patch Changes - 04548e2: Update swc_core to 0.103.x ## 3.0.0 ### Major Changes - f8e5fd0: Update swc_core to 0.102.x ## 2.0.15 ### Patch Changes - 7d17e25: Update swc_core to v0.101.x ## 2.0.14 ### Patch Changes - 7391419: Update swc_core to v0.100.0 ## 2.0.13 ### Patch Changes - 9c28afb: Update swc_core to 0.99.x (@swc/core 1.7.0) ## 2.0.12 ### Patch Changes - 06e1e66: Fix operation name detection ## 2.0.11 ### Patch Changes - 7984823: Use Arc instead of Config ## 2.0.10 ### Patch Changes - af25741: Update swc_core to 0.96.0 ## 2.0.9 ### Patch Changes - be5f997: Support multi-project mode ## 2.0.8 ### Patch Changes - 41a8f56: Update swc_core to v0.95.x ## 2.0.7 ### Patch Changes - fc30490: Update swc_core to v0.93.0 ## 2.0.6 ### Patch Changes - 67f7bc2: Publish packages ## 2.0.5 ### Patch Changes - 0f38844: Publish all chanages ## 2.0.4 ### Patch Changes - 1379d24: Make config parsing typed. ## 2.0.3 ### Patch Changes - 1cc9eda: Update dependencies ## 2.0.2 ### Patch Changes - 247cca6: Update rustc to 'nightly-2024-04-16' ## 2.0.1 ### Patch Changes - 876bbce: Update swc_core to 0.92.x ## 2.0.0 ### Major Changes - 8e91d39: Update swc_core to 0.91.x ## 1.6.0 ### Minor Changes - 8c6f890: Always add current directory to relative output paths ## 1.5.122 ### Patch Changes - f4df366: Update swc_core ## 1.5.121 ### Patch Changes - c88b22b: Align package metadata ## 1.5.120 ### Patch Changes - a3cc4fb: Organize pacakge metadata ## 1.5.119 ### Patch Changes - e9e78ef: Update swc crates ## 1.5.118 ### Patch Changes - 6096d6d: Fix plugin version schema issue ## 1.5.117 ### Patch Changes - 37d3aaf: Depend on the swc download counter package ## 1.5.116 ### Patch Changes - dc0dc6b: Use correct identifier for imports ## 1.5.115 ### Patch Changes - 8bd92c7: swc_core 0.90.x ## 1.5.114 ### Patch Changes - 4ef0b7f: Add changelog to the readme ## 1.5.113 ### Patch Changes - 4e72680: swc_core@0.88.0 ## 1.5.112 ### Patch Changes - 16bb4d8: swc_core@0.82.x