Skip to content

Global directory path attempts to resolve TS component twice #117

@oinkbark

Description

@oinkbark

Describe the bug
If you use TS and split your component into multiple files, you cannot use a directory named "global", otherwise it tries to add duplicate components.

I had my app set to auto build with the latest NPM packages, and this new update made my Nuxt project build fail with this warning:

Two component files resolving to the same name TheNavbar:
 - /app/src/components/global/TheNavbar/TheNavbar.vue
 - /app/src/components/global/TheNavbar/TheNavbar.ts

To Reproduce

nuxt.config.js

export default {
  components: [
      { path: '@/components/', extensions: ['vue'] }
  ],
  buildModules: [
      '@nuxt/typescript-build',
      '@nuxt/components'
  ]
}

/components/global/TheNavbar.vue

<template src="./TheNavbar.pug" lang="pug"></template>
<script src="./TheNavbar.ts" lang="ts"></script>
<style src="./TheNavbar.styl" scoped lang="stylus"></style>

Expected behavior
It does not try to load the component twice.

Additional context

  • Version: 1.2.0
  • Setting "global: false" does not fix the issue.
  • I do not use dynamic components. This was just the way I had my directory structure laid out.
  • If I rename the directory to anything else, such as "omni", it works just fine.
  • It also generates this render error as a side effect. I can provide the full "frames" array if needed:
  "error": {
    "message": "render function or template not defined in component: TheNavbar",
    "name": "Error",
    "frames": [ ],
    "hasInternal": true
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions