@originjs/vite-plugin-federation
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "@originjs/vite-plugin-federation", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A Vite plugin which support Module Federation.", | ||
@@ -33,3 +33,4 @@ "main": "dist/index.js", | ||
"prebuild": "rimraf dist", | ||
"build": "rollup -c --sourcemap" | ||
"build": "rollup -c", | ||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path ." | ||
}, | ||
@@ -45,4 +46,5 @@ "dependencies": { | ||
"@types/estree": "^0.0.50", | ||
"conventional-changelog-cli": "^2.1.1", | ||
"rollup": "^2.56.0" | ||
} | ||
} |
@@ -1,5 +0,67 @@ | ||
# Vite Module Federation Plugin | ||
# vite-plugin-federation | ||
Inspired by [webpack](https://github.com/webpack/webpack)'s module-federation feature. | ||
A Vite plugin which support Module Federation. | ||
Inspired by Webpack [Module Federation](https://webpack.js.org/concepts/module-federation/) feature. | ||
A Vite plugin which support Module Federation. | ||
## Install | ||
Using npm: | ||
``` | ||
npm install @originjs/vite-plugin-federation --save-dev | ||
``` | ||
## Usage | ||
- for a Vite project, in `vite.config.js`: | ||
```js | ||
import { defineConfig } from 'vite' | ||
import federation from "@originjs/vite-plugin-federation"; | ||
export default defineConfig({ | ||
plugins: [ | ||
federation({ | ||
name: 'module-name', | ||
filename: 'remoteEntry.js', | ||
exposes: { | ||
'./Button': './src/Button.vue', | ||
}, | ||
remotes:{ | ||
foo: 'remote_foo' | ||
} | ||
shared: ['vue'] | ||
}) | ||
], | ||
}) | ||
``` | ||
- for a Rollup project, in `rollup.config.js`: | ||
```js | ||
import federation from '@originjs/vite-plugin-federation' | ||
export default { | ||
input: 'src/index.js', | ||
output: { | ||
format: 'esm', | ||
dir: 'dist' | ||
}, | ||
plugins: [ | ||
federation({ | ||
filename: 'remoteEntry.js', | ||
exposes: { | ||
'./Button': './src/button' | ||
}, | ||
shared: ['react'] | ||
}) | ||
] | ||
} | ||
``` | ||
## Examples | ||
- [basic-host-remote](https://github.com/originjs/vite-plugin-federation/tree/main/packages/examples/basic-host-remote) | ||
- [simple-react](https://github.com/originjs/vite-plugin-federation/tree/main/packages/examples/simple-react) | ||
- [vue3-demo](https://github.com/originjs/vite-plugin-federation/tree/main/packages/examples/vue3-demo) |
@@ -76,2 +76,16 @@ /** | ||
type Remotes = (string | RemotesObject)[] | RemotesObject | ||
type Shared = (string | SharedObject)[] | SharedObject | ||
type ConfigTypeSet = ExposesConfig | RemotesConfig | SharedConfig | ||
declare interface SharedRuntimeInfo { | ||
id: string | ||
dependencies: string[] | ||
fileName: string | ||
fileDir: string | ||
filePath: string | ||
} | ||
/** | ||
@@ -220,3 +234,3 @@ * Modules that should be exposed by this container. Property names are used as public paths. | ||
*/ | ||
import?: string | false | ||
import?: boolean | ||
@@ -223,0 +237,0 @@ /** |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3822
68
157207
6
8
1