canirequire › CommonJS › phantomjs-prebuilt
Is phantomjs-prebuilt ESM-only? Can you require() it?
Headless WebKit with JS API
Latest version 2.1.16, published Nov 2, 2017. JSON
CommonJS CommonJS — require() works on every Node.js version
phantomjs-prebuilt ships CommonJS only. require("phantomjs-prebuilt") works everywhere. import "phantomjs-prebuilt" 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.
Deprecated: this package is now deprecated
Does phantomjs-prebuilt@2.1.16 actually load? Runtime test results
Runtime probe pending for this version. The values below are what package.json declares; they are refreshed once the probe runs.
| Runtime | require("phantomjs-prebuilt") | import "phantomjs-prebuilt" |
|---|---|---|
| Node.js 18 | ✓ expected | ✓ expected |
| Node.js 20 | ✓ expected | ✓ expected |
| Node.js 22 | ✓ expected | ✓ expected |
| Node.js 24 | ✓ expected | ✓ expected |
| Node.js 26 | ✓ expected | ✓ expected |
| Bun 1.4 | pending | pending |
Install failed in our sandbox: error: install script from "phantomjs-prebuilt" exited with 1 The rows above show what package.json declares.
How to import phantomjs-prebuilt
ES modules (import)
import phantomjsPrebuilt from "phantomjs-prebuilt";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 phantomjsPrebuilt = require("phantomjs-prebuilt");Module format by version
Derived from the type, main and exports fields of every stable release on npm (15 versions; the newest 15 shown).
| Versions | Format | First published |
|---|---|---|
| 2.1.2 – 2.1.16 | CommonJS | Jan 27, 2016 |
Frequently asked
Is phantomjs-prebuilt ESM-only?
phantomjs-prebuilt@2.1.16 is a CommonJS package. phantomjs-prebuilt ships CommonJS only. require("phantomjs-prebuilt") works everywhere. import "phantomjs-prebuilt" 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 phantomjs-prebuilt with ES module syntax?
Yes. import phantomjsPrebuilt from "phantomjs-prebuilt" 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 phantomjs-prebuilt ship TypeScript types?
No. phantomjs-prebuilt ships no type declarations and there is no @types package for it.
Links
Other commonjs packages
- debug 4.4.3CommonJS
- semver 7.8.5CommonJS
- ms 2.1.3CommonJS
- picomatch 4.0.7CommonJS
- ajv 8.20.0CommonJS
- source-map 0.8.0CommonJS
- react-is 19.2.8CommonJS
- readable-stream 4.7.0CommonJS
Similar popularity
- codelyzer 6.0.2CommonJS
- babel-plugin-import 1.13.8CommonJS
- karma-sourcemap-loader 0.4.0CommonJS
- rollup-plugin-babel 4.4.0CommonJS
- gulp-sass 6.0.1CommonJS
- karma-firefox-launcher 2.1.3CommonJS
- grunt-contrib-copy 1.0.0CommonJS
- bower 1.8.14CommonJS