8000 feat: support farm by ErKeLost · Pull Request #169 · unplugin/unplugin-vue · GitHub
[go: up one dir, main page]

Skip to content

feat: support farm #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: update farm
  • Loading branch information
ErKeLost committed Nov 28, 2024
commit 3a70ff3e43c4af4e824476a74151b4984aa2b756
48 changes: 46 additions & 2 deletions examples/farm/farm.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,54 @@
import { defineConfig } from '@farmfe/core'
import Vue from 'unplugin-vue/vite'
import Vue from 'unplugin-vue/farm'
import { existsSync, readFileSync } from 'node:fs';

import ViteVue from 'unplugin-vue/vite'
export default defineConfig({
vitePlugins: [Vue()],
// plugins: [Vue()],
plugins: [Vue(), test2()],
// vitePlugins: [ViteVue()],
// vitePlugins: [test3()],
compilation: {
persistentCache: false,
progress: false,
},
})

function test() {
return {
name: '213',

transform: {
filters: {
resolvedPaths: [".vue"],
},
executor: async (param, context, hookContext) => {
console.log(param.moduleId);
}
},
}
}
function test2() {
return {
name: "456",
priority: -100,
load: {
filters: {
resolvedPaths: [".vue"],
},
executor: async (param, context, hookContext) => {
const content = readFileSync(param.resolvedPath, 'utf-8');
return {
content,
moduleType: "js"
};
}
},
}
}

function test3() {
return {
name: "123"
}
}
1 change: 1 addition & 0 deletions examples/farm/src/a.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const a = 123
2 changes: 2 additions & 0 deletions examples/farm/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
// createApp(App).mount('#app');
import { createApp } from 'vue'
import App from './App.vue'
import { a } from './a.ts'
console.log(a);

createApp(App).mount('#app')
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"dependencies": {
"@vue/reactivity": "^3.5.4",
"debug": "^4.3.7",
"unplugin": "^1.14.1",
"unplugin": "/Users/adny/typescript/unplugin",
"vite": "^5.4.4"
},
"devDependencies": {
Expand Down
45 changes: 13 additions & 32 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,6 @@ export const plugin = createUnplugin<Options | undefined, false>(
},

resolveId(id) {
console.log(id);

// component export helper
if (normalizePath(id) === EXPORT_HELPER_ID) {
return id
Expand Down
2 changes: 1 addition & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default defineConfig({
format: ['esm', 'cjs'],
target: 'node18',
clean: true,
dts: true,
// dts: true,
splitting: true,
cjsInterop: true,
shims: true,
Expand Down
0