Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
browserify-global-pack
Advanced tools
Split your Browserify bundle into separate module files so that each can be embedded via a `<script>` tag.
Split your Browserify bundle into separate module files so that each can be embedded via a <script>
tag.
Similar to browserify-splitter, but outputs valid JS files instead of JS "chunks."
// a.js
module.exports = () => require('b')()
// b.js
module.exports = () => console.log('b');
const browserify = require('browserify'),
bundler = browserify('./a.js'),
browserifyGlobalPack = require('browserify-global-pack');
bundler.plugin(browserifyGlobalPack, {
writeToDir: './bundle'
});
Results in four files:
bundle/prelude.js
: Declares window.modules
object. Must be embedded before other scripts.bundle/a.js
: Adds module a
to window.modules
.bundle/b.js
: Adds module b
to window.modules
.bundle/postlude.js
: Defines require
and mounts require context.writeToDir
: Mandatory unless getOutfile
is set. String describing the path to the directory where deps will be saved.getOutfile
: Mandatory unless writeToDir
is set. Function. The first argument is a module-dep object. Every dep in the bundle passes through this function, which should return the path (string) to which the dep should be saved. If this function returns the same path for multiple deps, those deps will be combined into one file. If the function returns an array, the dep will be written to multiple files. Examples:
(dep) => path.join('bundle', 'dep-' + dep.id + '.js')
saves deps to the bundle
folder and prefix their filenames with dep-
.(dep) => 'deps.js'
save all deps to a single file, deps.js
.(dep) => path.join('bundle', (dep.id === 'a' || dep.id === 'b') ? 'group1.js' : 'group2.js')
saves modules a
and b
to a group1.js
file and all other deps to a group2.js
file.(dep) => ['a.js', 'b.js']
save all deps to two files, a.js
and b.js
.cache
: Optional. Array. If set, this plugin will save all deps to this array before writing them out. If deps are already in this array when bundling, any deps in it that do not appear in the bundle will be added to the bundle.scope
: Optional. String. Global-pack scope. Defaults to window.modules
.verbose
: Optional. Boolean. If true
, log each time a dep is written.FAQs
Split your Browserify bundle into separate module files so that each can be embedded via a `<script>` tag.
The npm package browserify-global-pack receives a total of 1,364 weekly downloads. As such, browserify-global-pack popularity was classified as popular.
We found that browserify-global-pack 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.