zephyr-rspack-plugin 0.0.49 → 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 +171 -8
- package/dist/package.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Zephyr Rspack Plugin
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-
[Zephyr Cloud](https://zephyr-cloud.io) | [Zephyr Docs](https://docs.zephyr-cloud.io/recipes/rspack-react) | [
|
|
5
|
+
[Zephyr Cloud](https://zephyr-cloud.io) | [Zephyr Docs](https://docs.zephyr-cloud.io/recipes/rspack-react) | [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
|
+
An Rspack plugin for deploying applications with Zephyr Cloud. This plugin integrates seamlessly with Rspack's fast bundling to enable deployment of your applications with Module Federation support. Read more from our documentation [here](https://docs.zephyr-cloud.io/recipes/react-rspack-nx).
|
|
11
12
|
|
|
12
13
|
## Installation
|
|
13
14
|
|
|
14
|
-
```
|
|
15
|
+
```bash
|
|
15
16
|
# npm
|
|
16
17
|
npm install --save-dev zephyr-rspack-plugin
|
|
18
|
+
|
|
17
19
|
# yarn
|
|
18
20
|
yarn add --dev zephyr-rspack-plugin
|
|
21
|
+
|
|
19
22
|
# pnpm
|
|
20
23
|
pnpm add --dev zephyr-rspack-plugin
|
|
24
|
+
|
|
21
25
|
# bun
|
|
22
26
|
bun add --dev zephyr-rspack-plugin
|
|
23
27
|
```
|
|
@@ -26,21 +30,180 @@ bun add --dev zephyr-rspack-plugin
|
|
|
26
30
|
|
|
27
31
|
### With Nx and Rspack
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
For Nx projects using Rspack:
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
// rspack.config.js
|
|
37
|
+
import { composePlugins, withNx } from '@nx/rspack';
|
|
38
|
+
import { withReact } from '@nx/react';
|
|
39
|
+
import { withModuleFederation } from '@nx/rspack/module-federation';
|
|
40
|
+
import { withZephyr } from 'zephyr-rspack-plugin';
|
|
41
|
+
|
|
42
|
+
const mfConfig = {
|
|
43
|
+
name: 'my-app',
|
|
44
|
+
remotes: {
|
|
45
|
+
'shared-ui': 'shared_ui@http://localhost:3001/remoteEntry.js',
|
|
46
|
+
},
|
|
47
|
+
shared: {
|
|
48
|
+
react: { singleton: true },
|
|
49
|
+
'react-dom': { singleton: true },
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
30
53
|
export default composePlugins(
|
|
31
54
|
withNx(),
|
|
32
55
|
withReact(),
|
|
33
56
|
withModuleFederation(mfConfig),
|
|
34
|
-
withZephyr(),
|
|
57
|
+
withZephyr(), // Add Zephyr plugin
|
|
35
58
|
(config) => {
|
|
36
59
|
return config;
|
|
37
60
|
}
|
|
38
61
|
);
|
|
39
62
|
```
|
|
40
63
|
|
|
41
|
-
### With Rspack
|
|
64
|
+
### With Rspack Directly
|
|
65
|
+
|
|
66
|
+
For standalone Rspack projects:
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
// rspack.config.js
|
|
70
|
+
const { withZephyr } = require('zephyr-rspack-plugin');
|
|
71
|
+
|
|
72
|
+
const config = {
|
|
73
|
+
entry: './src/index.js',
|
|
74
|
+
output: {
|
|
75
|
+
path: path.resolve(__dirname, 'dist'),
|
|
76
|
+
filename: '[name].[contenthash].js',
|
|
77
|
+
},
|
|
78
|
+
// ... other Rspack configuration
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
module.exports = withZephyr()(config);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### TypeScript Configuration
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
// rspack.config.ts
|
|
88
|
+
import { Configuration } from '@rspack/core';
|
|
89
|
+
import { withZephyr } from 'zephyr-rspack-plugin';
|
|
42
90
|
|
|
91
|
+
const config: Configuration = {
|
|
92
|
+
entry: './src/index.tsx',
|
|
93
|
+
output: {
|
|
94
|
+
path: path.resolve(__dirname, 'dist'),
|
|
95
|
+
filename: '[name].[contenthash].js',
|
|
96
|
+
},
|
|
97
|
+
// ... other configuration
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export default withZephyr({
|
|
101
|
+
// Zephyr options
|
|
102
|
+
deploy: true,
|
|
103
|
+
environment: 'production',
|
|
104
|
+
})(config);
|
|
43
105
|
```
|
|
44
|
-
module.exports = withZephyr()(your_rspack_config);
|
|
45
106
|
|
|
107
|
+
## Configuration Options
|
|
108
|
+
|
|
109
|
+
The `withZephyr` function accepts configuration options:
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
withZephyr({
|
|
113
|
+
// Enable/disable deployment
|
|
114
|
+
deploy: true,
|
|
115
|
+
|
|
116
|
+
// Deployment environment
|
|
117
|
+
environment: 'production',
|
|
118
|
+
|
|
119
|
+
// Module Federation configuration (if not using @nx/rspack)
|
|
120
|
+
moduleFederation: {
|
|
121
|
+
name: 'my-app',
|
|
122
|
+
remotes: {},
|
|
123
|
+
exposes: {},
|
|
124
|
+
shared: {},
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
// Additional metadata
|
|
128
|
+
metadata: {
|
|
129
|
+
version: '1.0.0',
|
|
130
|
+
description: 'My Rspack app',
|
|
131
|
+
},
|
|
132
|
+
});
|
|
46
133
|
```
|
|
134
|
+
|
|
135
|
+
## Features
|
|
136
|
+
|
|
137
|
+
- 🚀 Fast builds with Rspack's Rust-based bundler
|
|
138
|
+
- 🏗️ Full Module Federation support
|
|
139
|
+
- 📦 Automatic asset optimization and caching
|
|
140
|
+
- 🔧 Zero-config setup for simple applications
|
|
141
|
+
- 📊 Build analytics and monitoring
|
|
142
|
+
- 🌐 Global CDN distribution
|
|
143
|
+
- ⚡ Hot module replacement in development
|
|
144
|
+
- 🎯 Nx integration for monorepo support
|
|
145
|
+
|
|
146
|
+
## Module Federation Support
|
|
147
|
+
|
|
148
|
+
This plugin provides comprehensive Module Federation support:
|
|
149
|
+
|
|
150
|
+
- **Host Applications**: Consume remote modules from other applications
|
|
151
|
+
- **Remote Applications**: Expose modules for consumption by host applications
|
|
152
|
+
- **Shared Dependencies**: Efficient sharing of common libraries
|
|
153
|
+
- **Dynamic Imports**: Runtime loading of remote modules
|
|
154
|
+
- **Automatic Vendor Federation**: Smart dependency sharing
|
|
155
|
+
|
|
156
|
+
## Getting Started
|
|
157
|
+
|
|
158
|
+
1. Install the plugin in your Rspack project
|
|
159
|
+
2. Add it to your Rspack configuration
|
|
160
|
+
3. Configure Module Federation (if needed) for microfrontends
|
|
161
|
+
4. Build your application with `npm run build`
|
|
162
|
+
5. Your app will be automatically deployed to Zephyr Cloud
|
|
163
|
+
|
|
164
|
+
## Build Scripts
|
|
165
|
+
|
|
166
|
+
Add these scripts to your `package.json`:
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"scripts": {
|
|
171
|
+
"dev": "rspack serve",
|
|
172
|
+
"build": "rspack build",
|
|
173
|
+
"build:prod": "NODE_ENV=production rspack build"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Requirements
|
|
179
|
+
|
|
180
|
+
- Rspack 0.3 or higher
|
|
181
|
+
- Node.js 18 or higher
|
|
182
|
+
- Zephyr Cloud account (sign up at [zephyr-cloud.io](https://zephyr-cloud.io))
|
|
183
|
+
|
|
184
|
+
## Examples
|
|
185
|
+
|
|
186
|
+
Check out our [examples directory](../../examples/) for complete working examples:
|
|
187
|
+
|
|
188
|
+
- [rspack-sample-app](../../examples/rspack-sample-app/) - Basic Rspack setup
|
|
189
|
+
- [rspack-mf](../../examples/rspack-mf/) - Module Federation setup with host and remote
|
|
190
|
+
- [rspack-nx-mf](../../examples/rspack-nx-mf/) - Nx workspace with Rspack and Module Federation
|
|
191
|
+
|
|
192
|
+
## Nx Integration
|
|
193
|
+
|
|
194
|
+
This plugin works seamlessly with Nx workspaces:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Generate a new Rspack app with Module Federation
|
|
198
|
+
nx g @nx/rspack:app my-app --mf=true
|
|
199
|
+
|
|
200
|
+
# Add Zephyr plugin to the generated configuration
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Contributing
|
|
204
|
+
|
|
205
|
+
We welcome contributions! Please read our [contributing guidelines](../../CONTRIBUTING.md) for more information.
|
|
206
|
+
|
|
207
|
+
## License
|
|
208
|
+
|
|
209
|
+
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": "zephyr-rspack-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.50",
|
|
4
4
|
"description": "Repack plugin for Zephyr",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@rspack/core": "1.2.8",
|
|
21
21
|
"is-ci": "^4.1.0",
|
|
22
22
|
"tslib": "^2.8.1",
|
|
23
|
-
"zephyr-agent": "0.0.
|
|
24
|
-
"zephyr-xpack-internal": "0.0.
|
|
23
|
+
"zephyr-agent": "0.0.50",
|
|
24
|
+
"zephyr-xpack-internal": "0.0.50"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/is-ci": "3.0.4",
|