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

Open
wre232114 opened this issue Apr 19, 2024 · 0 comments · May be fixed by #1269
Open

Normalize usage of rust plugins and js plugins #1213

wre232114 opened this issue Apr 19, 2024 · 0 comments · May be 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.

@wre232114 wre232114 added this to the V1.2.0 milestone Apr 22, 2024
@callqh callqh linked a pull request Apr 30, 2024 that will close this issue
@callqh callqh self-assigned this Apr 30, 2024
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