farm-fe / farm

Extremely fast Vite-compatible web build tool written in Rust
https://farmfe.org
MIT License
4.56k stars 154 forks source link

[Bug Report]: yml This kind of module is not supported #1425

Open riderx opened 3 weeks ago

riderx commented 3 weeks ago

Steps to reproduce

Clone https://github.com/Cap-go/capgo/tree/farm run bun i then npm run serve And you should get the error: CleanShot 2024-06-24 at 04 30 30@2x

Reproduce link

https://github.com/Cap-go/capgo/tree/farm

What is actually happening?

It seems the YML cannot be parsed. i don't see any need of plugin in vite, so i think something is missing in farm. Maybe my config is off, but it mostly follow the one from Vitesse: https://github.com/antfu-collective/vitesse

System Info

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Max
    Memory: 140.92 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.14.0 - /usr/local/bin/node
    npm: 10.8.1 - /usr/local/bin/npm
    pnpm: 9.1.4 - /usr/local/bin/pnpm
    bun: 1.1.13 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 119.1.60.118
    Chrome: 124.0.6367.62
    Safari: 17.5
  npmPackages:
    @farmfe/core: ^1.2.0 => 1.2.0
wre232114 commented 3 weeks ago

currently you need plugin to support yml in farm, you can search vite plugin yaml and add it to vitePlugins of farm.config.ts

riderx commented 3 weeks ago

@wre232114 can you suggest any plugin ?

riderx commented 3 weeks ago

I tried: https://github.com/Modyfi/vite-plugin-yaml https://docs.astro.build/en/recipes/add-yaml-support/ https://www.npmjs.com/package/@originjs/vite-plugin-content https://www.npmjs.com/package/vite-plugin-yaml2 and didn't work

wre232114 commented 3 weeks ago

https://github.com/Modyfi/vite-plugin-yaml should work, Are you configured the plugin in vitePlugins of farm.config.ts. It may not work if you configure vite plugins in plugins of farm.config.ts

wre232114 commented 3 weeks ago

And we tested that this i18n plugin works for yaml too. https://github.com/farm-fe/farm-vue-pure-admin/blob/main/build/plugins.ts#L26

riderx commented 3 weeks ago

You can see my last attempt here: https://github.com/Cap-go/capgo/blob/farm/farm.config.mts Maybe there is something I'm missing.

wre232114 commented 3 weeks ago

I'll try this repo

wre232114 commented 3 weeks ago

farm.config.mts is not supported for now. You should use farm.config.ts instead

ErKeLost commented 2 weeks ago

@riderx https://farm-fe.github.io/docs/plugins/official-plugins/yaml try it

wre232114 commented 2 weeks ago

There are still other issues. @shulandmimi is working on the vite plugin compatibility