intlify / bundle-tools

bundling for intlify i18n tools
MIT License
244 stars 37 forks source link

Supports rspack #417

Open l246804 opened 1 week ago

l246804 commented 1 week ago

Clear and concise description of the problem

I want to support the rspack plugin, although webpack can still work in it, but it will inexplicably cause element-plus style import failure, I understand that it should be caused by incomplete compatibility? But when I don't import element-plus styles anymore, it works fine again...😅

Suggested solution

support the rspack plugin

Alternative

No response

Additional context

No response

Validations

l246804 commented 1 week ago

reproduce:

  1. pnpm create rsbuild@latest
  2. pnpm i element-plus @intlify/unplugin-vue-i18n
  3. update src/index.ts
    
    import { createApp } from 'vue';
    import App from './App.vue';
    import './index.css';
    import 'element-plus/theme-chalk/index.css'
    import 'element-plus/theme-chalk/dark/css-vars.css'

import ElementPlus from 'element-plus'

createApp(App).use(ElementPlus).mount('#root');

4. update rsbuild.config
```ts
import { defineConfig } from '@rsbuild/core';
import { pluginVue } from '@rsbuild/plugin-vue';
import vueI18n from '@intlify/unplugin-vue-i18n/webpack'

export default defineConfig({
  tools: {
    rspack: {
      plugins: [vueI18n()]
    }
  },

  plugins: [pluginVue()],
});
  1. pnpm dev or pnpm build image