From 5051ad91ff4252eff1a4596b0d3cb105a33c8334 Mon Sep 17 00:00:00 2001 From: Sasha Sorokin <10401817+brawaru@users.noreply.github.com> Date: Mon, 13 Nov 2023 21:36:07 +0100 Subject: [PATCH] Fix ambiguous default export (#113) Currently Omorphia's index file has both the default and named exports. While this is totally supported by native ESM, it's pretty hard for transpilers to process and may lead to situations where named exports cannot be imported directly, requiring destructuring on the default import. For this and just consistency reasons, you'd usually avoid mixing default and named exports. This commit removes the default export, making it just an another named export called `plugin`. BREAKING CHANGE: plugin is now exported using `plugin` export, rather than the default export. --- docs/.vitepress/theme/index.js | 2 +- lib/index.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/.vitepress/theme/index.js b/docs/.vitepress/theme/index.js index ef4c92a5d..f0f9d85f3 100644 --- a/docs/.vitepress/theme/index.js +++ b/docs/.vitepress/theme/index.js @@ -1,6 +1,6 @@ import { localeDefinitions } from '@modrinth/omorphia-dev/locales/index.js' import { createPlugin } from '@vintl/vintl/plugin' -import Omorphia from 'omorphia' +import { plugin as Omorphia } from 'omorphia' import DefaultTheme from 'vitepress/theme' import { createVNode } from 'vue' import DemoContainer from './DemoContainer.vue' diff --git a/lib/index.ts b/lib/index.ts index 450660b8a..efb66ca47 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -2,14 +2,13 @@ import * as components from './components/index.js' import FloatingVue from 'floating-vue' import { Plugin } from 'vue' -const plugin: Plugin = (app) => { +export const plugin: Plugin = (app) => { for (const key in components) { app.component(key, components[key as keyof typeof components]) } app.use(FloatingVue) } -export default plugin export * from './components/index.js' export * from './helpers/index.js'