Skip to content

Commit

Permalink
chore: update rslib demo
Browse files Browse the repository at this point in the history
  • Loading branch information
2heal1 committed Nov 13, 2024
1 parent 7facc10 commit de123c6
Show file tree
Hide file tree
Showing 6 changed files with 373 additions and 162 deletions.
11 changes: 9 additions & 2 deletions apps/rslib-module/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,21 @@ const config: StorybookConfig = {
options: {},
},
addons: [
{
name: getAbsolutePath('storybook-addon-rslib'),
options: {
rslib: {
include: ['**/stories/**'],
},
},
},
{
name: '@module-federation/storybook-addon/preset',
options: {
remotes: {
'rslib-module':
'rslib-module@http://localhost:3000/mf/mf-manifest.json',
'rslib-module@http://localhost:3001/mf/mf-manifest.json',
},
shareStrategy: 'loaded-first',
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion apps/rslib-module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Dev package
1.

```
nx serve rslib-module
nx dev rslib-module
```

2.
Expand Down
8 changes: 5 additions & 3 deletions apps/rslib-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,23 @@
"types": "./dist/cjs/index.d.ts",
"scripts": {
"build": "rslib build",
"serve": "pnpm build && http-server -p 3000 ./dist/ --cors",
"dev": "rslib mf dev",
"serve": "pnpm build && http-server -p 3001 ./dist/ --cors",
"storybook": "storybook dev -p 6006"
},
"devDependencies": {
"@module-federation/enhanced": "workspace:*",
"@module-federation/rsbuild-plugin": "workspace:*",
"@module-federation/storybook-addon": "workspace:*",
"@rsbuild/plugin-react": "^1.0.6",
"@rslib/core": "^0.0.14",
"@rslib/core": "^0.0.18",
"@types/react": "^18.3.11",
"http-server": "^14.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"storybook": "^8.3.6",
"storybook-react-rsbuild": "^0.1.1"
"storybook-react-rsbuild": "^0.1.1",
"storybook-addon-rslib": "^0.1.4"
},
"peerDependencies": {
"react": "*"
Expand Down
12 changes: 12 additions & 0 deletions apps/rslib-module/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
}
]
},
"dev": {
"executor": "nx:run-commands",
"options": {
"commands": ["npm run dev --prefix apps/rslib-module"]
},
"dependsOn": [
{
"target": "build",
"dependencies": true
}
]
},
"storybook": {
"executor": "nx:run-commands",
"options": {
Expand Down
7 changes: 7 additions & 0 deletions apps/rslib-module/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ export default defineConfig({
assetPrefix: 'http://localhost:3000/mf',
minify: true,
},
dev: {
assetPrefix: 'http://localhost:3001/mf',
},
// just for dev
server: {
port: 3001,
},
plugins: [
pluginModuleFederation({
name: 'rslib_provider',
Expand Down
Loading

0 comments on commit de123c6

Please sign in to comment.