Skip to content

Commit

Permalink
fix: trying out some things
Browse files Browse the repository at this point in the history
  • Loading branch information
MadaraUchiha-314 authored Sep 15, 2023
1 parent f88c0f3 commit 6248efa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/examples/project-a/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
13 changes: 12 additions & 1 deletion packages/rollup-plugin-module-federation/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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__';
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
*/
Expand All @@ -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.
Expand Down

0 comments on commit 6248efa

Please sign in to comment.