Skip to content

Commit 895eabe

Browse files
Submit rsbuild vue 3 vuex tailwindcss postcss example (#4143)
* rsbuild vue 3 vuex example * update read me * remove commented files --------- Co-authored-by: Zack Jackson <[email protected]>
1 parent 04381f4 commit 895eabe

28 files changed

+6171
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Module federation will work with any type of file that you're able to import, th
8484
- Shopify
8585
- adidas
8686
- Zomato
87+
- PayNet (Payments Network Malaysia)
8788
- and many more I cant remember
8889

8990
# Contribution to this repo

rsbuild-vue3-vuex/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Project Setup and rsbuild vue 3 vuex tailwindcss postcss example:
2+
3+
4+
## Setup Instructions
5+
6+
### 1. Clone the Repository
7+
8+
```bash
9+
git clone <repository-url>
10+
cd <repository-folder>
11+
```
12+
13+
### 2. Install Dependencies
14+
15+
You need to install dependencies for both the Provider and consumer folders.
16+
17+
#### In the Provider Folder
18+
19+
```bash
20+
cd provider
21+
yarn install
22+
```
23+
24+
#### In the Consumer Folder
25+
26+
Open a new terminal or navigate back to the root folder and then:
27+
28+
```bash
29+
cd consumer
30+
yarn install
31+
```
32+
33+
### 3. Run the Application
34+
35+
#### In the Consumer Folder
36+
37+
```bash
38+
yarn dev
39+
```
40+
41+
## Additional Notes
42+
43+
- Ensure that both the provider and consumer folders have their dependencies installed before running the application.

rsbuild-vue3-vuex/consumer/.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Local
2+
.DS_Store
3+
*.local
4+
*.log*
5+
6+
# Dist
7+
node_modules
8+
dist/
9+
10+
# IDE
11+
.vscode/*
12+
!.vscode/extensions.json
13+
.idea
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "osp-dispute-management",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "rsbuild dev --open",
7+
"build": "rsbuild build",
8+
"preview": "rsbuild preview"
9+
},
10+
"dependencies": {
11+
"vue": "3.2.31",
12+
"vue-router": "^4.0.13",
13+
"vuex": "^4.1.0"
14+
},
15+
"devDependencies": {
16+
"@module-federation/enhanced": "^0.1.19",
17+
"tailwindcss": "^3.0.24",
18+
"@rsbuild/core": "^0.7.9",
19+
"@rsbuild/plugin-vue": "^0.7.9",
20+
"typescript": "^5.4.5"
21+
},
22+
"license": "MIT"
23+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
plugins: {
3+
tailwindcss: {},
4+
},
5+
};
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { defineConfig } from "@rsbuild/core";
2+
import { pluginVue } from "@rsbuild/plugin-vue";
3+
// import { pluginEslint } from '@rsbuild/plugin-eslint';
4+
import path from "node:path";
5+
import { dependencies } from "./package.json";
6+
import { ModuleFederationPlugin } from "@module-federation/enhanced/rspack";
7+
8+
export default defineConfig({
9+
source: {
10+
entry: {
11+
index: "./src/main.js",
12+
},
13+
},
14+
server: {
15+
port: 3000,
16+
},
17+
output: {
18+
assetPrefix: '/',
19+
filenameHash: true,
20+
},
21+
tools: {
22+
rspack: (config, { appendPlugins }) => {
23+
// Will work in dev only if set to "/"
24+
config.resolve ||= {};
25+
config.resolve.alias ||= {};
26+
config.output ||= {};
27+
// public
28+
config.resolve.alias["@"] = path.resolve(__dirname, "src");
29+
appendPlugins([
30+
new ModuleFederationPlugin({
31+
name: `ASSET_HOST`,
32+
filename: `ASSET_HOST__remoteEntry.js`,
33+
remotes: {
34+
"@remote": "ASSET_REMOTE@http://localhost:3001/remoteEntry.js",
35+
},
36+
shared: {
37+
vue: {
38+
singleton: true,
39+
requiredVersion: dependencies.vue,
40+
},
41+
vuex: {
42+
singleton: true,
43+
requiredVersion: dependencies.vuex,
44+
},
45+
},
46+
}),
47+
]);
48+
},
49+
},
50+
plugins: [pluginVue({
51+
splitChunks: {
52+
vue: false,
53+
router: false
54+
}
55+
})],
56+
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script>
2+
export default {
3+
name: "App",
4+
};
5+
</script>
6+
<template>
7+
<div :class="$style.view">
8+
<div :class="$style.main">
9+
<router-view />
10+
</div>
11+
</div>
12+
</template>
13+
14+
<style module scoped>
15+
.view {
16+
@apply min-h-screen overflow-hidden bg-gray-100 print:!overflow-visible print:invisible print:h-full;
17+
}
18+
19+
.main {
20+
@apply m-auto;
21+
}
22+
</style>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { createApp } from "vue";
2+
import App from "./App.vue";
3+
import router from "./router";
4+
import store from "./store";
5+
const app = createApp(App);
6+
7+
export const bootstrap = () => {
8+
app
9+
.use(store(app))
10+
.use(router)
11+
.mount("#root");
12+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import("./bootstrap").then(({ bootstrap }) => bootstrap());
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { createRouter, createWebHistory } from "vue-router";
2+
import routes from "./routes";
3+
4+
const router = createRouter({
5+
hashbang: false,
6+
mode: "history",
7+
history: createWebHistory("/"),
8+
base: "/",
9+
routes,
10+
});
11+
12+
export default router;

0 commit comments

Comments
 (0)