Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
dynamic-import
Advanced tools
A library that allows you to dynamically load (and unload) scripts, CSS, and HTML templates and files in a browser.
Useful for preloading (in background), loading and unloading scripts inside
the <head>
of an html page, or cases when you may want to keep your css, js and templates
in separate files and only want to import them into an HTML page at different times.
npm i dynamic-import
You can also use the dist files in the browser.
<script type="module" src="node_modules/dynamic-import/dist/import.min.js"></script>
import { style } from 'node_modules/dynamic-import/dist/import.js';
const cssPaths = ['path/to/css/file.css', 'path/to/another/css/file.css'];
style.import(cssPaths).then(function () {
// css files have been loaded!
});
Load script files dynamically. When called, the supplied script
will be loaded into the <head>
of the DOM and run immediately.
import { script } from 'node_modules/dynamic-import/dist/import.js';
script.import('path/to/file.js').then(function () {
// script has been loaded into the `<head>` of document!
});
Load HTML file contents into an already-existing DOM element.
import { html } from 'node_modules/dynamic-import/dist/import.js';
html.import('path/to/html/file.html', document.body).then(function () {
// html contents have been loaded into the body element
});
FAQs
Dynamically load scripts, components, css, and templates
The npm package dynamic-import receives a total of 27 weekly downloads. As such, dynamic-import popularity was classified as not popular.
We found that dynamic-import 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.