Detects local CommonJS/UMD modules and converts them to ES modules for the dev server.
Production builds hand CommonJS files to the bundler, which wraps them itself.
The dev server serves each file as a native ES module, so a CommonJS file such
as Phoenix's vendored topbar.js needs the same interop before a browser can
import topbar from "../vendor/topbar".
Summary
Functions
Return whether the module at path is CommonJS/UMD rather than an ES module.
Bundle the CommonJS file at path into an ES module whose default export is
module.exports. Modules it requires are bundled along with it.
Functions
Return whether the module at path is CommonJS/UMD rather than an ES module.
.cjs and .cts files are CommonJS by extension. A .js file is CommonJS
when it has no import or export declarations and uses module.exports,
exports, or require.
Bundle the CommonJS file at path into an ES module whose default export is
module.exports. Modules it requires are bundled along with it.
Options
:modules— directories used to resolve barerequirespecifiers:module_types— bundler module type overrides