Skip to content

Home > vue-metamorph > astHelpers > createDefaultImport

astHelpers.createDefaultImport() function

Inserts a default import at the top of a script, or inserts a default import on an existing import declaration for the moduleSpecifier

Signature:

typescript
export declare function createDefaultImport(ast: namedTypes.Program, moduleSpecifier: string, importName: string): void;

Parameters

Parameter

Type

Description

ast

namedTypes.Program

The script AST

moduleSpecifier

string

The module name to import from

importName

string

The name of the default import

**Returns:**

void