Skip to content

Cannot use wildcards in Vue Single-File-Components files #35

@chamberlainpi

Description

@chamberlainpi

Importing a full directory of files only seems to work when the statement is used in a *.js file.
I can at least import other file types (like *.vue files) but unfortunately I'm trying to get the initial import statement to work in a root app.vue file, instead of falling back on importing a separate *.js file that serves as an "includes" file for the directories I need to import.

Example, a folder structure containing:

  • app.vue
    ./ui/
    - button.vue
    - checkbox.vue
    ./views/
    - projects.vue
    - demos.vue

In app.vue:

import * as ui from './ui/*';
import * as views from './views/*';

export default {
        components: _.extend( {}, ui, views ),
 ...
}

I get this error:

Error: Can't resolve './ui/*' in 'D:\path-of-my-project\vue'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions