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

Normalize usage of rust plugins and js plugins #1213

Closed
wre232114 opened this issue Apr 19, 2024 · 0 comments · Fixed by #1269
Closed

Normalize usage of rust plugins and js plugins #1213

wre232114 opened this issue Apr 19, 2024 · 0 comments · Fixed by #1269
Assignees
Milestone

Comments

@wre232114
Copy link
Member

What problem does this feature solve?

Configuring rust plugins and js plugins in farm.config.ts uses different methods currently, for example:

import farmSassPlugin from '@farmfe/js-plugins-sass';

export default defineConfig({
  plugins: [
    // rust plugin
    ['@farmfe/plugin-react', {}], 
    // js plugin
    farmSassPlugin({
      // globals: ['./src/variables.scss']
    })
  ],
});

Farm uses @farmfe/plugin-react to configure rust plugins and uses farmSassPlugin({}) to configure js plugins. It's in consistent and it's hard to add types for rust plugin options.

we need to normalize this 2 methods.

What does the proposed API look like?

import react from '@farmfe/plugin-react';
import farmSassPlugin from '@farmfe/js-plugins-sass';

export default defineConfig({
  plugins: [
    react({}),
    farmSassPlugin({
      // globals: ['./src/variables.scss']
    })
  ],
});

using new react({}) strategy to configuring rust plugin, and keep the old ways compatible.

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

Successfully merging a pull request may close this issue.

2 participants