module-federation/module-federation-examples

Issue with startup code while specifying remote source

rushtokunal opened this issue · 3 comments

I was trying to include the start up code in the example https://github.com/module-federation/module-federation-examples/blob/master/startup-code/app1/webpack.config.js by following the article https://scriptedalchemy.medium.com/micro-fe-architecture-webpack-5-module-federation-and-custom-startup-code-9cb3fcd066c.

When i add the line app1: "./src/setPublicPath",
module.exports = { entry: { // we add an entrypoint with the same name as our name in ModuleFederationPlugin. // This merges the two "chunks" together. When a remoteEntry is placed on the page, // the code in this app1 entrypoint will execute as part of the remoteEntry startup. app1: "./src/setPublicPath", main: "./src/index", },

here https://github.com/module-federation/module-federation-examples/blob/master/startup-code/app1/webpack.config.js#L9

I get this following exception:

Field 'browser' doesn't contain a valid alias configuration
    using description file: /Users/3758757/Downloads/module-federation-examples-master/startup-code/app1/package.json (relative path: ./src/setPublicPath)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Users/3758757/Downloads/module-federation-examples-master/startup-code/app1/src/setPublicPath doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /Users/3758757/Downloads/module-federation-examples-master/startup-code/app1/src/setPublicPath.js doesn't exist
      .json
        Field 'browser' doesn't contain a valid alias configuration
        /Users/3758757/Downloads/module-federation-examples-master/startup-code/app1/src/setPublicPath.json doesn't exist
      .wasm
        Field 'browser' doesn't contain a valid alias configuration
        /Users/3758757/Downloads/module-federation-examples-master/startup-code/app1/src/setPublicPath.wasm doesn't exist
      as directory
        /Users/3758757/Downloads/module-federation-examples-master/startup-code/app1/src/setPublicPath doesn't exist

webpack 5.36.1 compiled with 2 errors in 1367 ms

havent seen this before, also havent tried using startup code in a long while

Are you including the browser startup code in a node build?

Also have this exact same problem. Any updates?