vite-plugin-zephyr 0.0.48 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +158 -7
- package/dist/package.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
@@ -1,39 +1,190 @@
|
|
1
|
-
#
|
1
|
+
# Vite Plugin Zephyr
|
2
2
|
|
3
3
|
<div align="center">
|
4
4
|
|
5
|
-
[Zephyr Cloud](https://zephyr-cloud.io) | [Zephyr Docs](https://docs.zephyr-cloud.io
|
5
|
+
[Zephyr Cloud](https://zephyr-cloud.io) | [Zephyr Docs](https://docs.zephyr-cloud.io) | [Discord](https://zephyr-cloud.io/discord) | [Twitter](https://x.com/ZephyrCloudIO) | [LinkedIn](https://www.linkedin.com/company/zephyr-cloud/)
|
6
6
|
|
7
7
|
<hr/>
|
8
|
+
<img src="https://cdn.prod.website-files.com/669061ee3adb95b628c3acda/66981c766e352fe1f57191e2_Opengraph-zephyr.png" alt="Zephyr Logo" />
|
8
9
|
</div>
|
9
10
|
|
10
|
-
|
11
|
+
A Vite plugin for deploying applications with Zephyr Cloud. This plugin integrates with Vite's build process to enable seamless deployment of your applications with Module Federation support. Read more from our documentation [here](https://docs.zephyr-cloud.io/recipes/react-vite).
|
11
12
|
|
12
13
|
## Installation
|
13
14
|
|
14
|
-
```
|
15
|
+
```bash
|
15
16
|
# npm
|
16
17
|
npm install --save-dev vite-plugin-zephyr
|
18
|
+
|
17
19
|
# yarn
|
18
20
|
yarn add --dev vite-plugin-zephyr
|
21
|
+
|
19
22
|
# pnpm
|
20
23
|
pnpm add --dev vite-plugin-zephyr
|
24
|
+
|
21
25
|
# bun
|
22
26
|
bun add --dev vite-plugin-zephyr
|
23
27
|
```
|
24
28
|
|
25
29
|
## Usage
|
26
30
|
|
27
|
-
|
31
|
+
### Basic Configuration
|
32
|
+
|
33
|
+
Add the plugin to your Vite configuration:
|
34
|
+
|
35
|
+
```javascript
|
36
|
+
// vite.config.js
|
37
|
+
import { defineConfig } from 'vite';
|
38
|
+
import react from '@vitejs/plugin-react';
|
39
|
+
import { withZephyr } from 'vite-plugin-zephyr';
|
40
|
+
|
41
|
+
export default defineConfig({
|
42
|
+
plugins: [react(), withZephyr()],
|
43
|
+
build: {
|
44
|
+
target: 'chrome89',
|
45
|
+
},
|
46
|
+
});
|
47
|
+
```
|
48
|
+
|
49
|
+
### With Module Federation
|
50
|
+
|
51
|
+
For microfrontend applications using Module Federation:
|
28
52
|
|
29
|
-
```
|
53
|
+
```javascript
|
54
|
+
// vite.config.js
|
55
|
+
import { defineConfig } from 'vite';
|
56
|
+
import react from '@vitejs/plugin-react';
|
30
57
|
import { withZephyr, type ModuleFederationOptions } from 'vite-plugin-zephyr';
|
31
58
|
|
59
|
+
const mfConfig = {
|
60
|
+
name: 'my-app',
|
61
|
+
remotes: {
|
62
|
+
shared: 'shared@http://localhost:3001/remoteEntry.js',
|
63
|
+
},
|
64
|
+
shared: {
|
65
|
+
react: { singleton: true },
|
66
|
+
'react-dom': { singleton: true },
|
67
|
+
},
|
68
|
+
};
|
69
|
+
|
70
|
+
export default defineConfig({
|
71
|
+
plugins: [
|
72
|
+
react(),
|
73
|
+
withZephyr({ mfConfig })
|
74
|
+
],
|
75
|
+
build: {
|
76
|
+
target: 'chrome89',
|
77
|
+
},
|
78
|
+
});
|
79
|
+
```
|
80
|
+
|
81
|
+
### TypeScript Configuration
|
82
|
+
|
83
|
+
```typescript
|
84
|
+
// vite.config.ts
|
85
|
+
import { defineConfig } from 'vite';
|
86
|
+
import react from '@vitejs/plugin-react';
|
87
|
+
import { withZephyr, type ModuleFederationOptions } from 'vite-plugin-zephyr';
|
88
|
+
|
89
|
+
const mfConfig: ModuleFederationOptions = {
|
90
|
+
name: 'host-app',
|
91
|
+
remotes: {
|
92
|
+
'remote-app': 'remoteApp@http://localhost:3001/remoteEntry.js',
|
93
|
+
},
|
94
|
+
shared: {
|
95
|
+
react: { singleton: true },
|
96
|
+
'react-dom': { singleton: true },
|
97
|
+
},
|
98
|
+
};
|
99
|
+
|
32
100
|
export default defineConfig({
|
33
101
|
plugins: [react(), withZephyr({ mfConfig })],
|
34
102
|
build: {
|
35
103
|
target: 'chrome89',
|
36
104
|
},
|
37
105
|
});
|
38
|
-
export default config;
|
39
106
|
```
|
107
|
+
|
108
|
+
## Configuration Options
|
109
|
+
|
110
|
+
The `withZephyr` function accepts the following options:
|
111
|
+
|
112
|
+
```javascript
|
113
|
+
withZephyr({
|
114
|
+
// Module Federation configuration
|
115
|
+
mfConfig: {
|
116
|
+
name: 'my-app',
|
117
|
+
remotes: {},
|
118
|
+
exposes: {},
|
119
|
+
shared: {},
|
120
|
+
},
|
121
|
+
|
122
|
+
// Zephyr-specific options
|
123
|
+
options: {
|
124
|
+
deploy: true,
|
125
|
+
environment: 'production',
|
126
|
+
},
|
127
|
+
});
|
128
|
+
```
|
129
|
+
|
130
|
+
## Features
|
131
|
+
|
132
|
+
- 🚀 Seamless deployment during Vite build
|
133
|
+
- 🏗️ Module Federation support via [@module-federation/vite](https://github.com/module-federation/vite)
|
134
|
+
- 📦 Asset optimization and caching
|
135
|
+
- 🔧 Zero-config setup for simple applications
|
136
|
+
- 📊 Build analytics and monitoring
|
137
|
+
- 🌐 Global CDN distribution
|
138
|
+
- ⚡ Hot module replacement in development
|
139
|
+
|
140
|
+
## Module Federation Support
|
141
|
+
|
142
|
+
This plugin uses the official [vite plugin from Module Federation](https://github.com/module-federation/vite) under the hood, providing:
|
143
|
+
|
144
|
+
- **Host Applications**: Consume remote modules from other applications
|
145
|
+
- **Remote Applications**: Expose modules for consumption by host applications
|
146
|
+
- **Shared Dependencies**: Efficient sharing of common libraries
|
147
|
+
- **Dynamic Imports**: Runtime loading of remote modules
|
148
|
+
|
149
|
+
## Getting Started
|
150
|
+
|
151
|
+
1. Install the plugin in your Vite project
|
152
|
+
2. Add it to your Vite configuration
|
153
|
+
3. Configure Module Federation (if needed) for microfrontends
|
154
|
+
4. Build your application with `vite build`
|
155
|
+
5. Your app will be automatically deployed to Zephyr Cloud
|
156
|
+
|
157
|
+
## Build Scripts
|
158
|
+
|
159
|
+
Add these scripts to your `package.json`:
|
160
|
+
|
161
|
+
```json
|
162
|
+
{
|
163
|
+
"scripts": {
|
164
|
+
"dev": "vite",
|
165
|
+
"build": "vite build",
|
166
|
+
"preview": "vite preview"
|
167
|
+
}
|
168
|
+
}
|
169
|
+
```
|
170
|
+
|
171
|
+
## Requirements
|
172
|
+
|
173
|
+
- Vite 4.x or higher
|
174
|
+
- Node.js 18 or higher
|
175
|
+
- Zephyr Cloud account (sign up at [zephyr-cloud.io](https://zephyr-cloud.io))
|
176
|
+
|
177
|
+
## Examples
|
178
|
+
|
179
|
+
Check out our [examples directory](../../examples/) for complete working examples:
|
180
|
+
|
181
|
+
- [vite-react-ts](../../examples/vite-react-ts/) - Basic React + TypeScript setup
|
182
|
+
- [vite-react-mf](../../examples/vite-react-mf/) - Module Federation setup with host and remote
|
183
|
+
|
184
|
+
## Contributing
|
185
|
+
|
186
|
+
We welcome contributions! Please read our [contributing guidelines](../../CONTRIBUTING.md) for more information.
|
187
|
+
|
188
|
+
## License
|
189
|
+
|
190
|
+
Licensed under the Apache-2.0 License. See [LICENSE](LICENSE) for more information.
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite-plugin-zephyr",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.50",
|
4
4
|
"description": "Vite plugin for Zephyr",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -23,8 +23,8 @@
|
|
23
23
|
"is-ci": "^4.1.0",
|
24
24
|
"json5": "2.2.3",
|
25
25
|
"rollup": "^4.36.0",
|
26
|
-
"vite": "^6.2.
|
27
|
-
"zephyr-agent": "0.0.
|
26
|
+
"vite": "^6.2.7",
|
27
|
+
"zephyr-agent": "0.0.50"
|
28
28
|
},
|
29
29
|
"devDependencies": {
|
30
30
|
"@types/is-ci": "3.0.4",
|