+6
import-map-overrides.json
+6
import-map-overrides.json
+7
-1
index.js
+7
-1
index.js
···
1
1
module.exports = function babelPluginModularGraphql({ types: t }) {
2
2
const importMap = require('./import-map.json');
3
+
const importMapOverrides = require('./import-map-overrides.json');
3
4
const PKG_NAME = 'graphql';
4
5
5
6
return {
···
12
13
const imports = node.specifiers.reduce((acc, specifier) => {
13
14
if (t.isImportSpecifier(specifier)) {
14
15
const imported = specifier.imported.name;
15
-
const declaration = importMap[imported];
16
+
17
+
let declaration = importMap[imported];
18
+
if (importMapOverrides[imported]) {
19
+
declaration = importMapOverrides[imported];
20
+
}
21
+
16
22
const from = declaration ? declaration.from : PKG_NAME;
17
23
if (!acc[from]) {
18
24
acc[from] = t.importDeclaration([], t.stringLiteral(from));