Skip to content

babel prevents ESM import #77

@noraj

Description

@noraj

I'm trying to port the CommonJS (CJS) import to a ECMAScript Modules (ESM) import. cf. https://gist.github.com/noraj/007a943dc781dc8dd3198a29205bae04

From:

var jest = require('gulp-jest').default;

to

import gulpJest from 'gulp-jest';

But it fails with the following error when running gulp:

[18:00:50] TypeError: gulpJest is not a function
    at test_data (file:///home/noraj/Dev/rawsec-cybersecurity-inventory/gulpfile.mjs:178:15)
    at bound (node:domain:433:15)
    at runBound (node:domain:444:12)
    at asyncRunner (/home/noraj/Dev/rawsec-cybersecurity-inventory/node_modules/async-done/index.js:55:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11

However node_modules/gulp-jest/lib/index.js seems to have an uncommon way to export.

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

...

var _default = function _default() {...};

exports["default"] = _default;

Could you provide me an example to how to import gulp-jest in a .mjs file or maybe patch the export if it's the cause.

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