Skip to content

RelayCompilerWebpackPluginOptions and relay.config.js overlap and mismatch #68

@sorenhoyer

Description

@sorenhoyer

Currently the relay.config.js and the configuration object that is passed to RelayCompilerWebpackPlugin has some overlap, but is also inconsistent.

For example you'll find both schema, src, exclude, include, extensions and artifactDirectory at the top level of the configuration object, so it would only be natural to assume that you could pass the whole configuration object from relay.config.js into RelayCompilerWebpackPlugin.

However if you want to eg. turn on noFutureProofEnums, you have to pass it into the nested "config" object.

{
  // schema: ...
  // exclude: ...
  // include: ...
  // src: ...
  // artifactDirectory: ...
  // extensions: ...
  config: {
    noFutureProofEnums: true
    // etc...
  }
}

When adopting this plugin in our code, suddenly we had "%future value added" all over the place, and at first we assumed it was because of some updated dependency and undocumented change, so we first adjusted our code.

I think this can cause others some headaches as well, until they find out about this. So I think either this should be changed (would be best as we can just import relay.config.js and have it in 1 place) or a note about this should be added to the docs, or at least the config object should be partially typed and not as any as it is now.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions