vuejs / repl

Vue SFC REPL as a Vue 3 component
https://repl-vuejs.vercel.app
MIT License
930 stars 172 forks source link

Bug: monaco editor does not consider `dependencyVersion` defined in store #269

Open larsrickert opened 3 months ago

larsrickert commented 3 months ago

Hey, we are using the @vue/repl package for the playground of our onyx component library. We have added a select to choose the used version of the onyx library and have defined the dependencyVersion property of useStore() like so:

const onyxVersion = ref("1.0.0-beta.0");
const { vueVersion, importMap } = useVueImportMap({ vueVersion: "latest" });

const store = useStore(
  {
    builtinImportMap: computed(() =>
      mergeImportMap(importMap.value, {
        imports: {
          "sit-onyx": `https://cdn.jsdelivr.net/npm/sit-onyx@${onyxVersion.value}/dist/index.js`,
        },
      }),
    ),
    dependencyVersion: computed(() => {
      return { "sit-onyx": onyxVersion.value };
    }),
  },
  // initialize repl with previously serialized state
  location.hash.slice(1),
);

Since @vue/repl version 4.3.0 this no longer works because the editor always loads the latest version/tag (sit-onyx@latest) which is not correct because it should consider the dependencyVersion.