Skip to content

Commit 7717409

Browse files
authored
feat: support farm (#169)
1 parent e5905c5 commit 7717409

File tree

11 files changed

+873
-120
lines changed

11 files changed

+873
-120
lines changed

examples/farm/farm.config.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from '@farmfe/core'
2+
import Vue from 'unplugin-vue/farm'
3+
4+
export default defineConfig({
5+
plugins: [Vue()],
6+
compilation: {
7+
progress: false,
8+
persistentCache: false,
9+
},
10+
})

examples/farm/index.html

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
8+
<title>Farm + Vue3 + TS</title>
9+
</head>
10+
11+
<body>
12+
<div id="app"></div>
13+
<script src="./src/main.ts"></script>
14+
</body>
15+
16+
</html>

examples/farm/package.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "farm-vue",
3+
"version": "1.0.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "farm start",
7+
"start": "farm start",
8+
"build": "farm build",
9+
"preview": "farm preview",
10+
"clean": "farm clean"
11+
},
12+
"dependencies": {
13+
"vue": "^3.4.0"
14+
},
15+
"devDependencies": {
16+
"@farmfe/cli": "2.0.0-nightly-20250411100807",
17+
"core-js": "^3.30.1",
18+
"unplugin-vue": "workspace:*"
19+
}
20+
}

examples/farm/public/favicon.ico

4.06 KB
Binary file not shown.

examples/farm/src/App.vue

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script setup lang="ts">
2+
import { ref } from 'vue'
3+
const msg = ref('')
4+
</script>
5+
6+
<template>
7+
<div>
8+
<h1>Hello world</h1>
9+
<h2>{{ msg }}</h2>
10+
<input v-model="msg" type="text" />
11+
</div>
12+
</template>

examples/farm/src/main.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { createApp } from 'vue'
2+
import App from './App.vue'
3+
4+
createApp(App).mount('#app')

examples/farm/tsconfig.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"useDefineForClassFields": true,
5+
"module": "ESNext",
6+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"skipLibCheck": true,
8+
9+
/* Bundler mode */
10+
"moduleResolution": "bundler",
11+
"allowImportingTsExtensions": true,
12+
"resolveJsonModule": true,
13+
"isolatedModules": true,
14+
"noEmit": true,
15+
"jsx": "preserve",
16+
17+
/* Linting */
18+
"strict": true,
19+
"noUnusedLocals": true,
20+
"noUnusedParameters": true,
21+
"noFallthroughCasesInSwitch": true
22+
},
23+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
24+
}

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"./rollup": "./dist/rollup.js",
4040
"./rolldown": "./dist/rolldown.js",
4141
"./esbuild": "./dist/esbuild.js",
42+
"./farm": "./dist/farm.js",
4243
"./api": "./dist/api.js",
4344
"./*": "./*"
4445
},
@@ -70,6 +71,7 @@
7071
},
7172
"devDependencies": {
7273
"@babel/types": "^7.27.0",
74+
"@farmfe/core": "2.0.0-nightly-20250411141103",
7375
"@jridgewell/gen-mapping": "^0.3.8",
7476
"@jridgewell/trace-mapping": "^0.3.25",
7577
"@sxzz/eslint-config": "^6.1.1",

0 commit comments

Comments
 (0)