Skip to content

Instantly share code, notes, and snippets.

@sibelius
Created November 30, 2023 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sibelius/75a4ef146d886a48fcf5ed96b33d5c29 to your computer and use it in GitHub Desktop.
Save sibelius/75a4ef146d886a48fcf5ed96b33d5c29 to your computer and use it in GitHub Desktop.
trying to bundle many frontends in a single webpack
module.exports = merge(rspackDevConfig, {
entry: {
main: './src/index.tsx',
login: '../login/src/index.tsx',
console: '../console/src/index.tsx',
},
devServer: {
port: PORT,
...getOpen('/home'),
...getProxy(),
historyApiFallback: {
disableDotRule: true,
rewrites: [
{ from: /^\/home\/.*$/, to: '/home/index.html' },
{ from: /^\/login\/.*$/, to: '/login/index.html' },
{ from: /^\/console\/.*$/, to: '/console/index.html' },
],
},
},
watchOptions: getWebpackWatchOptions(getIgnoredEntrypoints('main')),
plugins: [
new rspack.HtmlRspackPlugin({
template: path.join(cwd, './src/index.html'),
publicPath: '/home',
chunks: ['main'],
}),
new rspack.HtmlRspackPlugin({
template: path.join(cwd, '../login/src/index.html'),
publicPath: '/login',
chunks: ['login'],
}),
new rspack.HtmlRspackPlugin({
template: path.join(cwd, '../console/src/index.html'),
publicPath: '/console',
chunks: ['console'],
}),
],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment