Skip to content

Commit 61625d4

Browse files
fix(rspack): import plugin from sub path (#3349)
Co-authored-by: Zack Jackson <[email protected]>
1 parent 82591ed commit 61625d4

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

.changeset/six-yaks-teach.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/rspack': patch
3+
---
4+
5+
fix(rspack): import plugin from sub path

packages/enhanced/src/rspack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { ModuleFederationPlugin } from '@module-federation/rspack';
1+
export { ModuleFederationPlugin } from '@module-federation/rspack/plugin';

packages/rspack/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,20 @@
3939
"import": "./dist/index.esm.js",
4040
"require": "./dist/index.cjs.js",
4141
"types": "./dist/index.cjs.d.ts"
42+
},
43+
"./plugin": {
44+
"types": "./dist/plugin.cjs.d.ts",
45+
"import": "./dist/plugin.esm.mjs",
46+
"require": "./dist/plugin.cjs.js"
4247
}
4348
},
4449
"typesVersions": {
4550
"*": {
4651
".": [
4752
"./dist/index.cjs.d.ts"
53+
],
54+
"plugin": [
55+
"./dist/plugin.cjs.d.ts"
4856
]
4957
}
5058
},

packages/rspack/rollup.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
const copy = require('rollup-plugin-copy');
22
const replace = require('@rollup/plugin-replace');
3+
const path = require('path');
34

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

8+
rollupConfig.input['plugin'] = path.resolve(
9+
process.cwd(),
10+
'./packages/rspack/src/ModuleFederationPlugin.ts',
11+
);
712
rollupConfig.plugins.push(
813
replace({
914
__VERSION__: JSON.stringify(pkg.version),

packages/rspack/src/ModuleFederationPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
Compiler,
33
ModuleFederationPluginOptions,
44
RspackPluginInstance,

0 commit comments

Comments
 (0)