How can we have same npm package with two different versions in each single-spa application #890
Replies: 1 comment 8 replies
-
If the central-design package is not a webpack external, this is accomplished simply by adding the correct version of it to each microfrontend's package.json. If the central-design package is a webpack external loaded as an in-browser systemjs module, then you can use import map scopes to control which applications get which versions. See https://github.com/WICG/import-maps#scoping-examples In #891 you provided a bit more detail about what's going on - it seems related to component registration. Generally, global component registration can lead to problems if you need multiple versions. Which framework are you using? If Vue, you can have one version of the components registered globally, and then the other version just available for use within components without global registration. For example, see the code below: <template>
<!-- use globally registered components for central-design@1.0.0 -->
<my-button>1</my-button>
<!-- use locally registered component from central-design@2.0.0 -->
<MyButton>2</MyButton>
</template>
<script>
import { MyButton, MyInput } from 'central-design';
export default {
components: {
Button,
Input
}
}
</script> |
Beta Was this translation helpful? Give feedback.
-
App 1 -npm package- central-design-0.1
App 2 -npm package-central-design-0.2
Beta Was this translation helpful? Give feedback.
All reactions