Skip to content

Commit

Permalink
add terminal link to plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Kivylius committed Feb 18, 2024
1 parent 14590ba commit fe58dd8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const { HtmlRspackPlugin, container: {ModuleFederationPlugin} } = require('@rspack/core');
const path = require('path');
const package = require('./package.json');
const isDevelopment = process.env.NODE_ENV === "development";
const name = `${isDevelopment? "local_" : ""}${package.name}`;
const port = 3002;

module.exports = {
entry: './src/index',
Expand All @@ -10,7 +13,11 @@ module.exports = {
static: {
directory: path.join(__dirname, 'dist'),
},
port: 3002,
port,
setupMiddlewares: (middlewares, devServer) => {
console.log(`\x1b[32m[webdeck-plugin] Plugin url:\x1b[0m \x1b[36mhttp://localhost:${port}/remoteEntry.js?name=${name}\x1b[0m \n`)
return middlewares;
},
},
output: {
publicPath: 'auto',
Expand Down Expand Up @@ -44,10 +51,10 @@ module.exports = {
},
plugins: [
new ModuleFederationPlugin({
name: package.name,
name: name,
library: {
type: 'global',
name: package.name.replaceAll("-", "_")
name: name.replaceAll("-", "_")
},
filename: 'remoteEntry.js',
exposes: {
Expand Down

0 comments on commit fe58dd8

Please sign in to comment.