Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alias Vue in config.js not working #1065

Closed
3 tasks done
fcapaldi opened this issue Jul 25, 2022 · 0 comments
Closed
3 tasks done

Alias Vue in config.js not working #1065

fcapaldi opened this issue Jul 25, 2022 · 0 comments
Labels
build Related to the build system

Comments

@fcapaldi
Copy link

fcapaldi commented Jul 25, 2022

Describe the bug

I am documenting a vue 3 component which uses a dynamic template:

This requires use of vue/dist/vue.esm-bundler.js.

The application itself works with the following alias in the vite.config.ts file:

export default defineConfig({
  plugins: [vue()],
  define: {
    global: {},
  },
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
      'vue': 'vue/dist/vue.esm-bundler.js',
      './runtimeConfig': './runtimeConfig.browser',
    },
  },
});

However, the vitepress documentation does not. I have added the same alias to the vitepress configuration file:

const path = require('path')
module.exports = {
  title: '',
  description: '',
  themeConfig: {
    repo: '',
    sidebar: [
      {
        text: 'Introduction',
        items: [
          { text: 'What is My Lib?', link: '/' },
        ],
      }, {
        text: 'Components',
        items: [
          { text: 'B-Markdown', link: '/components/b-markdown/desc' },
        ],
      }
    ],
  },
  vite: {
    resolve: {
      alias: {
        'vue': 'vue/dist/vue.esm-bundler.js'
      }
    },
  }
}

The dynamic component does not display and a vue warning is generated suggesting that I add the alias to the bundler:

runtime-core.esm-bundler.js:38 [Vue warn]: Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js". 
  at <Anonymous content="Test content." imgFolder="" class="toastui-editor-contents"  ... > 
  at <VRuntimeTemplate class="toastui-editor-contents" style= {max-width: '900px', margin: 'auto'} template="<div><p>Test content.</p>\n</div>" > 
  at <BMarkdown content="Test content." > 
  at <Basic> 
  at <DemoContainer> 
  at <Components/bMarkdown/desc.md> 
  at <VitePressContent class="vp-doc _components_b-markdown_desc" > 
  at <VPDoc key=3 > 
  at <VPContent> 
  at <Layout> 
  at <VitePressApp>


Reproduction

  1. Create a dynamic component using vue3-runtime-template.
  2. Add the dynamic component to a vitepress documentation page.
  3. Attempt to view the documentation page.

Expected behavior

Expect to see the dynamic component (which works in the vite application but not in the vitepress documentation).

System Info

System:
    OS: Linux 5.4 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (32) x64 AMD Ryzen 9 5950X 16-Core Processor
    Memory: 1.45 GB / 15.59 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
  npmPackages:
    vitepress: ^1.0.0-alpha.4 => 1.0.0-alpha.4

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@fcapaldi fcapaldi added the bug: pending triage Maybe a bug, waiting for confirmation label Jul 25, 2022
@brc-dd brc-dd added bug build Related to the build system and removed bug: pending triage Maybe a bug, waiting for confirmation labels Aug 1, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build Related to the build system
Projects
None yet
Development

No branches or pull requests

2 participants