Skip to content
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

WIP feat: support vue #628

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist
compiled
*.yaml
*.yaml
node_modules
2 changes: 1 addition & 1 deletion bin/father.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

require('v8-compile-cache');
// require('v8-compile-cache');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删了吧,引这个会有其他异常

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的 昨晚被坑了 1个小时

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

具体是啥问题?看 Umi 也把这个去掉了

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

无法使用 esm 的包 比如 vite 使用会有问题

Copy link
Member

@xiaohuoni xiaohuoni Apr 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

umi 非 dev 的时候,这代码进不去
const { build } = await import("./build.js");

require('../dist/cli/cli')
.run()
.catch((e) => {
Expand Down
12 changes: 6 additions & 6 deletions examples/with-vue/.fatherrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { defineConfig } from 'father';
import path from 'path';

export default defineConfig({
// esm: {},
esm: {},
// cjs: {},
umd: {
externals: {
vue: 'vue',
},
},
// umd: {
// externals: {
// vue: 'vue',
// },
// },
alias: {
'@': path.resolve(__dirname, './src'),
},
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"scripts": {
"build": "father build",
"build": "rm -rf ./node_modules/.cache && father build",
"build:no-clean": "father build --no-clean",
"dev": "father dev",
"doctor": "father doctor",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vue/src/A.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ElEmpty from './Empty.vue';
import ElEmpty from './Empty.vue.b';
import type { CSSProperties, FunctionalComponent } from 'vue';

type EmptyRendererProps = {
Expand Down
14 changes: 12 additions & 2 deletions examples/with-vue/src/Empty.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@

<script lang="ts" setup>
import { computed } from 'vue';
import { emptyProps } from './empty';
// import { emptyProps } from './empty';

import type { CSSProperties } from 'vue';

const props = defineProps(emptyProps);
const props = defineProps({
image: {
type: String,
default: '',
},
imageSize: Number,
description: {
type: String,
default: '',
},
});

const emptyDescription = computed(() => props.description);
const imageStyle = computed<CSSProperties>(() => ({
Expand Down
2 changes: 2 additions & 0 deletions examples/with-vue/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import Hello from './Hello.vue';
import Empty from './Empty.vue';
import A from '@/A';
import Content from '@/Content';

export default {
Hello,
Empty,
A,
Content,
};