Skip to content

Commit

Permalink
fix(rspack): import plugin from sub path (#3349)
Browse files Browse the repository at this point in the history
Co-authored-by: Zack Jackson <[email protected]>
  • Loading branch information
2heal1 and ScriptedAlchemy authored Dec 13, 2024
1 parent 82591ed commit 61625d4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-yaks-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/rspack': patch
---

fix(rspack): import plugin from sub path
2 changes: 1 addition & 1 deletion packages/enhanced/src/rspack.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { ModuleFederationPlugin } from '@module-federation/rspack';
export { ModuleFederationPlugin } from '@module-federation/rspack/plugin';
8 changes: 8 additions & 0 deletions packages/rspack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,20 @@
"import": "./dist/index.esm.js",
"require": "./dist/index.cjs.js",
"types": "./dist/index.cjs.d.ts"
},
"./plugin": {
"types": "./dist/plugin.cjs.d.ts",
"import": "./dist/plugin.esm.mjs",
"require": "./dist/plugin.cjs.js"
}
},
"typesVersions": {
"*": {
".": [
"./dist/index.cjs.d.ts"
],
"plugin": [
"./dist/plugin.cjs.d.ts"
]
}
},
Expand Down
5 changes: 5 additions & 0 deletions packages/rspack/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
const copy = require('rollup-plugin-copy');
const replace = require('@rollup/plugin-replace');
const path = require('path');

module.exports = (rollupConfig, projectOptions) => {
const pkg = require('./package.json');

rollupConfig.input['plugin'] = path.resolve(
process.cwd(),
'./packages/rspack/src/ModuleFederationPlugin.ts',
);
rollupConfig.plugins.push(
replace({
__VERSION__: JSON.stringify(pkg.version),
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack/src/ModuleFederationPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
Compiler,
ModuleFederationPluginOptions,
RspackPluginInstance,
Expand Down

0 comments on commit 61625d4

Please sign in to comment.