Skip to content

Add import function #132

@kaidesu

Description

@kaidesu

Ghost already supports importing modules using the following syntax:

import { Example } from 'example'

Adding an import function variant would allow developers to dynamically load in and assign values during runtime. For example, it would be possible to scan and auto-import a directory of ghost files:

files = scanDirectory('config')

for (file in files) {
  const config = import(file)

  // do something with "config"
}

This would re-use the existing import keyword but would be invoked as a function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions