Skip to content

Support ES modules with TypeScript #574

@mook-as

Description

@mook-as

Jest has experimental support for ECMAScript Modules (ESM). It is useful because more libraries are starting to ship only ESM (that is, they are no longer shipping CommonJS).

Currently, when transforming TypeScript, vue-jest forces the use of CommonJS:

// Force es5 to prevent const vue_1 = require('vue') from conflicting
target: typescript.ScriptTarget.ES5,
module: typescript.ModuleKind.CommonJS

This means it is not possible to import ESM from a Vue SFC. It would be nice to have a way to override this so that it can be used in an otherwise ESM project.

(I realize that there's probably nobody around who'd want to work on this, but I figured I should at least document it for when I next try this again…)

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