-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Expose a config option for artifactDirectory #309
Comments
Are you using a https://relay.dev/docs/getting-started/installation-and-setup/#compiler-configuration |
Yes, but you need to configure this both in the plugin as well as in the
https://github.com/facebook/relay/tree/main/packages/relay-compiler#configuration |
I see. From version 13 it will read the relay.config.js In the meantime you copy the plugin into your project as a temporary solution vite.config.ts import type { Plugin } from "vite";
import { defineConfig } from "vite";
import { transformSync } from "@babel/core";
function relay(): Plugin {
return {
name: "vite:relay",
transform(src, id) {
let code = src;
if (/.(t|j)sx?/.test(id) && src.includes("graphql`")) {
const out = transformSync(src, {
plugins: [
[
require.resolve("babel-plugin-relay"),
{
// TODO: your custom config
},
],
],
code: true,
});
if (!out?.code) throw new Error("vite-plugin-react Failed to build");
code = out.code;
}
return {
code,
map: null,
};
},
};
}
export default defineConfig({
plugins: [..., relay],
}); |
I came back to this and figured out why it was failing. It wasn't the inability to specify the |
This should also be resolved by my PR: #424 |
relay-compiler and babel-plugin-relay have an
artifactDirectory
config option to control the location of the generated files. The babel plugin and the relay-compiler config need to have the same location configure to work correctly. Currently this plugin doesn't expose a mechanism for configuring this so users cannot use this option in the relay compiler.The text was updated successfully, but these errors were encountered: