canirequire

canirequireCommonJS › gulp-if

Is gulp-if ESM-only? Can you require() it?

Conditionally run a task

Last verified Sep 9, 2026 against gulp-if@3.0.0. JSON

CommonJS CommonJS — require() works on every Node.js version

gulp-if ships CommonJS only. require("gulp-if") works everywhere. import "gulp-if" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

Latest
3.0.0 (Jul 18, 2019)
Module format
CommonJS
Last CommonJS version
3.0.0
TypeScript types
@types/gulp-if
Node engines
not declared
Weekly downloads
310K
License
MIT

Does gulp-if@3.0.0 actually load? Runtime test results

Installed and executed on Sep 9, 2026 with require("gulp-if") from a CommonJS file and import "gulp-if" from an ES module.

Runtimerequire("gulp-if")import "gulp-if"
Node.js 18✓ works✓ works
Node.js 20✓ works✓ works
Node.js 22✓ works✓ works
Node.js 24✓ works✓ works
Node.js 26✓ works✓ works
Bun 1.4✓ works✓ works

How to import gulp-if

ES modules (import)

import gulpIf from "gulp-if";

Named imports from a CommonJS package only work when Node.js can statically detect them. If a named import fails, use the default import and destructure.

CommonJS (require)

const gulpIf = require("gulp-if");

Module format by version

Derived from the type, main and exports fields of every stable release on npm (15 versions; the newest 15 shown).

VersionsFormatFirst published
0.0.3 – 3.0.0CommonJSJan 7, 2014

Frequently asked

Is gulp-if ESM-only?

gulp-if@3.0.0 is a CommonJS package. gulp-if ships CommonJS only. require("gulp-if") works everywhere. import "gulp-if" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

Can I import gulp-if with ES module syntax?

Yes. import gulpIf from "gulp-if" works in Node.js and Bun because they support importing CommonJS modules. Named imports work only when Node.js can statically detect the exports.

Does gulp-if work in Bun?

Yes. import "gulp-if" loaded successfully in Bun 1.4 on Sep 9, 2026.

Does gulp-if ship TypeScript types?

Not bundled. Install the community types with "npm install -D @types/gulp-if".

Links

Other commonjs packages

Similar popularity