Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to use my application both as a general mfe app and by Exporting the kanbancard from within the sub-application. I made the code below, but my mfe application is crashing, how do I do it? #1

Open
tunahan-guler opened this issue Dec 28, 2023 · 0 comments

Comments

@tunahan-guler
Copy link

`import { appTools, defineConfig, mergeConfig } from '@modern-js/app-tools'
import { garfishPlugin } from '@modern-js/plugin-garfish/cli'
import { tailwindcssPlugin } from '@modern-js/plugin-tailwindcss';
import ChunkPatchPlugin from './ChunkPatchPlugin';

// https://modernjs.dev/en/configure/app/usage
export default defineConfig({
html: {
title: 'CRM',
},
dev: {
port: 8081,
assetPrefix: 'http://localhost:8081/',
},
runtime: {
router: true,
state: true,
},
source: {
enableAsyncEntry: true,
},
deploy: {
microFrontend: true,
},
tools:{
devServer:{
headers:{
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
}
},
webpack: (config, { webpack, appendPlugins }) => {
//@ts-ignore

  config.output.publicPath = '/';
  appendPlugins([
    new webpack.container.ModuleFederationPlugin({
      name: 'provider',
      library: { type: 'var', name: 'provider' },
      filename: 'static/js/remoteEntry.js',
      exposes: {
        './OffersTab': './src/@components/KanbanCard/KanbanCard',
      },
      shared: {
        react: { singleton: true },
        'react-dom': { singleton: true },
      },
    }),
    new ChunkPatchPlugin('provider'),
  ]);
  // modern.js set runtimeChunk true by default
  delete config.optimization?.runtimeChunk;
},

},
plugins: [appTools(), garfishPlugin(), tailwindcssPlugin()],
})
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant