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.

Append extension to filename to prevent issue with webpack5 (#1)

* Append filename to prevent issue with webpack5

* Add option to switch between mjs and js

authored by

Jovi De Croock and committed by
GitHub
d639c84c 35f3d4d5

+2 -2
+2 -2
index.js
··· 1 - module.exports = function babelPluginModularGraphql({ types: t }) { 1 + module.exports = function babelPluginModularGraphql({ types: t }, { esm } = { esm: false }) { 2 2 const importMap = require('./import-map.json'); 3 3 const importMapOverrides = require('./import-map-overrides.json'); 4 4 const PKG_NAME = 'graphql'; ··· 21 21 22 22 const from = declaration ? declaration.from : PKG_NAME; 23 23 if (!acc[from]) { 24 - acc[from] = t.importDeclaration([], t.stringLiteral(from)); 24 + acc[from] = t.importDeclaration([], t.stringLiteral(from + esm ? '.mjs' : '.js')); 25 25 } 26 26 27 27 const localName = specifier.local.name;