relay-tools / vscode-apollo-relay

Simple configuration of vscode-apollo for Relay projects.
MIT License
49 stars 13 forks source link

Get rid of need for dependencies.ts #12

Open alloy opened 5 years ago

alloy commented 5 years ago

This is going to go wrong more than once, so we should replace it with something transparent.

The simplest approach looks to be to write code as normal, e.g.:

import { visit } from "graphql"

But then after compiling it we run an additional babel transform or sed script that rewrites it to:

const { visit } = require("./graphql")

…where ./graphql is a module that does the dance to get vscode-apollo’s node_modules.

alloy commented 5 years ago

I just recalled that I wrote this codemod before https://github.com/artsy/codemods/blob/master/src/update-import-source.ts, which we should be able to re-use for this purpose.

alloy commented 5 years ago

I started on a branch here https://github.com/relay-tools/vscode-apollo-relay/tree/fix-dependency-hell but haven't gotten it to work yet.

@kastermester feel free to take a stab at it, if you wish.