arco-design / arco-plugins

Webpack / Vite plugins for Arco Design
https://arco.design
MIT License
68 stars 41 forks source link

feat(unplugin): remove import modifier when module is external #68

Closed Justinidlerz closed 1 month ago

Justinidlerz commented 1 month ago

Types of changes

Background and context

Due to import modifier priority is higher than externals, the import path will be modified and lost context chain.

For example: Main app:

import {Provider} from '@arco-design/web';

const App = () => {
    return <Provider><SubApp /></Provider>
}

Sub app:

import {Table} from '@arco-design/web';

const App = () => {
    return <Table />
}

subapp.rspack.config.js

module.exports = {
    externals: {
        '@arco-design/web': 'window.externals["@arco-design/web"]'
    }
}

There we want't modify the import {Table} from '@arco-design/web' to import Table from '@arco-design/web/es/Table'

Changelog

Changelog(CN) Changelog(EN) Related issues
修复由于引用修改导致 external 失效问题 Fix external problems due to import modify

Checklist:

Other information