Makes pinia-stores names unique between builds.
This matters if you are developing MFE, because you can intersect in pinia-stores names and this breaks application flow. This plugin solves this problem because stores names become unique between builds and it never intersects with other applications.
You can add the plugin to vite.config
such as any other plugin and give it any salt you want:
plugins: [
saltifyPiniaStores({
salt: `${salt}_${pkg.name}`,
logEnable: true,
})
]
salt
- value to be added in pinia-stores names. If the option is not passed plugin generates unique value as saltlogEnable
- log display flag
You need to disable plugin for test environment.
plugins: [
isTesting ? saltifyPiniaStores({
salt: `${salt}_${pkg.name}`,
logEnable: true,
}) : false
].filter(Boolean)