Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
ember-browserify
Advanced tools
ember-cli addon for easily loading CommonJS modules from npm via browserify.
This is an ember-cli addon for easily loading CommonJS modules from npm via browserify.
It works with ember-cli >= 0.1.3.
Add to your ember app:
npm install --save-dev ember-browserify
Then npm install
any modules you want to load into your Ember app:
npm install --save-dev my-cool-module
Then within your app, you can import the module:
import MyCoolModule from "npm:my-cool-module";
We're careful to only re-invoke browserify when necessary. If your set of imported modules remains stable and you aren't editing them, everything is served out of cache.
If you import a new npm module or edit an already-imported one, you get automatic rebuilds.
You can put a browserify
key in your app's config/environment.js
to customize the behavior:
browserify: {
extensions: ['.coffee'],
transform: [
['caching-coffeeify', { global: true }]
]
}
Ember-browserify cannot be used with named imports e.g. import { foo } from 'bar';
as we have no way of knowing at the time of browserifying what portions of the import are being used.
Wrapping generic npm libraries is a pretty common use case for ember addons. Unfortunately, ember-browserify installed on an addon cannot simply consume an npm dependency for the host app. This is a limitation of ember-cli. More info in this issue and this issue. Try it, and you'll probably get this error:
Path or pattern "browserify/browserify.js" did not match any files
Error: Path or pattern "browserify/browserify.js" did not match any files
Or you might get an error like:
Could not find module `npm:my-module` imported from `my-project/my-file`
To have the host app consume the npm dependency, ember-browserify and the npm dependency must be installed in the host app as well AND the module must be imported from within the app/
directory of the addon. So in your app, simply npm install ember-browserify and whatever npm dependencies you need consumed by ember-browserify. Then in your addon, make sure that you're importing the modules from a file in the app/
folder. You can also import from the addon/
directory IF you've also imported the same module in the app/
directory. This is because ember-browserify running under the host application can't detect imports in the addon/
directory, since the app/
directory is the only directory merged with the application tree at build.
Eventually, ember-cli will be able to directly pull in npm depedencies to an ember app without the need for ember-browserify. Progress on this ember-cli feature can be tracked in this issue ticket.
FAQs
ember-cli addon for easily loading CommonJS modules from npm via browserify.
The npm package ember-browserify receives a total of 2,501 weekly downloads. As such, ember-browserify popularity was classified as popular.
We found that ember-browserify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
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.