Vue 3 + Vite + TypeScript + Vitest + ESLint
This template will help you quickly start developing tools with Vue 3, Vite, TypeScript, Element Plus and Tailwind.
yarnyarn devyarn buildRun Unit Tests with Vitest
yarn test:unitLint with ESLint
yarn lintYou can scaffold a new tool project based on this boilerplate using degit:
npx degit CroudTech/fe-tool-boilerplate croud-tool
cd croud-tool
yarn install
yarn dev- Rename
croud-toolto desired tool project name. - Update
package.jsonwith new tool project name. - (Optional) Re-init git:
git init git add . git commit -m "Initial commit"
To enable Module Federation and allow this app to expose specific views (or any modules) to a host application, follow these steps:
Open your vite.config.ts file and set up the federation plugin with the views you want to expose:
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import federation from '@originjs/vite-plugin-federation'
export default defineConfig({
plugins: [
vue(),
federation({
name: 'fe_tool',
filename: 'remoteEntry.js',
exposes: {
'./DashboardView': './src/views/DashboardView.vue',
'./NewRunView': './src/views/NewRunView.vue',
'./ResultView': './src/views/ResultView.vue',
},
shared: ['vue'],
}),
],
build: {
target: 'esnext',
minify: false,
cssCodeSplit: false,
},
})Run the build command to generate the remoteEntry.js file that a host app can consume:
yarn buildThis sets up the app as a remote module, exposing DashboardView, NewRunView, and ResultView to be used in a host app via Module Federation.