diff --git a/packages/examples/project-a/src/index.js b/packages/examples/project-a/src/index.js index ce14f95..1a3c3af 100644 --- a/packages/examples/project-a/src/index.js +++ b/packages/examples/project-a/src/index.js @@ -3,6 +3,7 @@ import { v4 as uuidv4 } from 'uuid'; import { ABC } from './abc'; export { createStore } from 'redux'; +export { applyMiddleware as kindlyApplyMiddleware } from 'redux'; /* eslint-disable no-console */ diff --git a/packages/rollup-plugin-module-federation/src/index.js b/packages/rollup-plugin-module-federation/src/index.js index 93b54d5..8a781e0 100644 --- a/packages/rollup-plugin-module-federation/src/index.js +++ b/packages/rollup-plugin-module-federation/src/index.js @@ -18,6 +18,8 @@ import { PACKAGE_JSON } from './constants.js'; const IMPORTS_TO_FEDERATED_IMPORTS_NODES = { ImportDeclaration: 'ImportDeclaration', ImportExpression: 'ImportExpression', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportAllDeclaration: 'ExportAllDeclaration', }; const REMOTE_ENTRY_MODULE_ID = '__remoteEntry__'; @@ -101,6 +103,14 @@ export function getFederatedImportStatementForNode(node, moduleSpecifier) { federatedImportStms.push(moduleSpecifier); break; } + case IMPORTS_TO_FEDERATED_IMPORTS_NODES.ExportNamedDeclaration: { + console.log(node); + break; + } + case IMPORTS_TO_FEDERATED_IMPORTS_NODES.ExportAllDeclaration: { + console.log(node); + break; + } default: { break; } @@ -396,6 +406,7 @@ export default function federation(federationConfig) { async handler(code, id) { const ast = this.parse(code); const magicString = new MagicString(code); + console.log(magicString.toString()); /** * We don't want to rewrite the imports for the remote entry as well as the implementation of the federated import expression */ @@ -415,7 +426,7 @@ export default function federation(federationConfig) { if ( Object.keys(IMPORTS_TO_FEDERATED_IMPORTS_NODES).includes( node.type, - ) + ) && node?.source?.value ) { /** * At this point rollup hasn't completed resolution of the import statements in this file.