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
base: master
Are you sure you want to change the base?
Conversation
@@ -1,6 +1,6 @@ | |||
#!/usr/bin/env node | |||
|
|||
require('v8-compile-cache'); | |||
// require('v8-compile-cache'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
删了吧,引这个会有其他异常
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的 昨晚被坑了 1个小时
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
具体是啥问题?看 Umi 也把这个去掉了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
无法使用 esm 的包 比如 vite 使用会有问题
There was a problem hiding this comment.
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");
这算不算重复做好几次,umi father dumi? |
不是场景不一样, 考虑过共用的问题 成本过高 不过可以做的事情 比如把 babel-preset-vue 维护到 umi |
babel-preset-vue 是不是可以用 babel-preset-umi 加几个配置? |
@@ -5,3 +5,8 @@ export type { | |||
IFatherConfig, | |||
IJSTransformer, | |||
} from './types'; | |||
|
|||
export type { | |||
ILoaderOutput, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
导出得加个前缀了,IBundlessLoaderXXX
|
||
console.log(dirname(this.paths.fileAbsPath)); | ||
|
||
const [{ output }] = (await viteBuilder({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所以 Vue 组件的 bundless 构建本质上是对每个 .vue
文件 bundle 再单独输出?这里用 Vite 是生态缘故还是因为快,如果 bundle/bundless 统一用 webpack 会有问题吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里其实更多是 复用当前架构吧, 复用 father 现在的代码逻辑不做大的变化, 完全用 vite 处理会更简单一点(ps 如果重名的复杂度太高可能会考虑 完成用 vite(rullup) 处理), 用 webpack 其实以没有问题 这里主要考虑还是生态问题 vite 是现在 vue 官方默认的选项 长远来看 可能 vite 更合适
@@ -0,0 +1,43 @@ | |||
// MIT: copy from https://github.com/vercel/next.js/blob/canary/packages/next/build/webpack/require-hook.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这部分逻辑能直接做在 bundler-webpack 里吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bundler-webpack 有这部分逻辑, deps 有细微差异 我晚点在 bundler-webpack 处理看看
@@ -1,6 +1,6 @@ | |||
#!/usr/bin/env node | |||
|
|||
require('v8-compile-cache'); | |||
// require('v8-compile-cache'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
具体是啥问题?看 Umi 也把这个去掉了
@@ -0,0 +1,45 @@ | |||
import type Config from '@umijs/bundler-webpack/compiled/webpack-5-chain'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能否依赖 @umijs/preset-vue
这个包,直接引用里面的 config 逻辑,这样只需要维护一处
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接依赖 有成本 如果抽离一个包 共享感觉是一个方案
|
哈哈 还没有搞完, 其实是需要封装的 直接用 vite 也需要搞配置(我目前想的是尽量复用 father 的代码) |
No description provided.