
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
browserize
Advanced tools
Converts simple node.js modules into ES6 modules.
browserize
turns this:
module.exports = function defaultExport() {}
into this:
export default function defaultExport() {}
browserize
does not:
require
s into import
sbrowserize
is made for small packages without dependencies that should run both in node.js and in the browser.
If your package has any dependency, it's probably complex enough to warrant babel, webpack, or some such. Use that instead.
If you need to transpile anything, like CoffeScript or TypeScript, your tooling for that should cover you.
Open an issue, and let's talk about it π
npx browserize [--no-default|-x] [[--default|-d] index.js] [[--named|-n] helpers.js] [[--output|-o] index.mjs]
npx browserize
This reads index.js
and writes the equivalent index.mjs
, and that's it.
npm browserize -n helper-functions
This reads index.js
and helper-functions.js
, then transforms concatenates them, and finally writes the result to index.mjs
.
browserize
coversnpx browserize class-name.jsx helper-functions.js dist/browser-magic.js
This includes named exports and sets custom paths for everything.
browserize
takes an options object with three optional entries:
default
: the file where the default export is found, defaults to index.js
named
: where to find the named exports, defaults to null
output
: where to write the ESM file, defaults to index.mjs
And that is it.
const browserize = require('browserize')
browserize()
This reads index.js
and writes the equivalent index.mjs
, and that's it.
browserize
coversconst browserize = require('browserize')
browserize({
default: 'class-name.jsx',
named: 'helper-functions.js',
output: 'dist/browser-magic.js',
})
This includes named exports and sets custom paths for everything.
browserize
is a simple tool and has a few simple requirements:
module.exports
module.exports = class DefaultExport {}
module.exports = {
key1: helper1,
key2: helper2,
}
exports.key1 = helper1
exports.key2 = helper2
While valid, browserize
does not know how to transform this.
module.exports = export1
module.exports = export2
This is not useful anyway.
window.myStuff = class DefaultExport {}
This is not a module.
module.exports = class DefaultExport {}
module.exports = class DefaultExport {
}
module.exports =
class DefaultExport {}
While this is valid in node.js, it will lead to an invalid ESM file.
module.exports = { helper1, helper2 }
module.exports = {
key1: helper1,
key2: helper2,
}
module.exports.key1 = helper1
module.exports.key2 = helper2
While this is valid in node.js, browserize
does not understand it.
This is too complex, and has no real benefit over the object literal.
FAQs
Converts simple node.js modules into ES6 modules
The npm package browserize receives a total of 0 weekly downloads. As such, browserize popularity was classified as not popular.
We found that browserize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.