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

[Feature Request]: Can not resolve @/xxxxxx from jsx file #1442

Closed
hugang opened this issue Jun 25, 2024 · 2 comments
Closed

[Feature Request]: Can not resolve @/xxxxxx from jsx file #1442

hugang opened this issue Jun 25, 2024 · 2 comments

Comments

@hugang
Copy link

hugang commented Jun 25, 2024

What problem does this feature solve?

i am use @ for src folder in vite, here is my config.
and now i am tring to use farm but i got an error.
Can not resolve @/xxxxxx from jsx file.
can i do the same thing in farm?

alias: {
"@": path.resolve(__dirname, "src"),
},

What does the proposed API look like?

use @ as src

@wre232114
Copy link
Member

What's your farm.config.ts? You should use:

import { defineConfig } from '@farmfe/core';
import Vue from '@vitejs/plugin-vue'
import farmJsPluginLess from '@farmfe/js-plugin-less';
import path from 'path';


export default defineConfig({
  compilation: {
    resolve: {
+      alias: {
+       '/@': path.join(process.cwd(), 'src')
+     }
    }
  },
  plugins: [farmJsPluginLess()],
  vitePlugins: [Vue()]
});

see https://github.com/farm-fe/farm/blob/main/examples/vue-antdv/farm.config.ts

@hugang
Copy link
Author

hugang commented Jun 26, 2024

thx. close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants