Mirror: Modular GraphQL.js import paths without the hassle.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Replace ES export with module.exports

+5 -11
+5 -11
index.js
··· 1 - export default function({ types: t }) { 2 const importMap = require('./import-map.json'); 3 const PKG_NAME = 'graphql'; 4 ··· 22 const newImportedName = declaration ? declaration.local : imported; 23 24 acc[from].specifiers.push( 25 - t.importSpecifier( 26 - t.identifier(localName), 27 - t.identifier(newImportedName) 28 - ) 29 ); 30 } 31 ··· 33 }, {}); 34 35 const importFiles = Object.keys(imports); 36 - if ( 37 - importFiles.length && 38 - (importFiles.length !== 1 || importFiles[0] !== PKG_NAME) 39 - ) { 40 - path.replaceWithMultiple(importFiles.map(key => imports[key])); 41 } 42 }, 43 }, 44 }, 45 }; 46 - }
··· 1 + module.exports = function babelPluginModularGraphql({ types: t }) { 2 const importMap = require('./import-map.json'); 3 const PKG_NAME = 'graphql'; 4 ··· 22 const newImportedName = declaration ? declaration.local : imported; 23 24 acc[from].specifiers.push( 25 + t.importSpecifier(t.identifier(localName), t.identifier(newImportedName)) 26 ); 27 } 28 ··· 30 }, {}); 31 32 const importFiles = Object.keys(imports); 33 + if (importFiles.length && (importFiles.length !== 1 || importFiles[0] !== PKG_NAME)) { 34 + path.replaceWithMultiple(importFiles.map((key) => imports[key])); 35 } 36 }, 37 }, 38 }, 39 }; 40 + };