
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
enhanced-require
Advanced tools
Enhance the require function in node.js with support for loaders which preprocess files and really async require (AMD).
More features for node.js require.
require.ensure
require
, define
(from require.js)require.context
Asynchron require functions are really async. They do not use the sync node.js require, but use a async resolving and async readFile.
Add this line to a node.js module to activate the enhanced features in that module:
require = require("enhanced-require")(module);
// and optionally if your want require.js style defines:
if(typeof define != "function") var define = require.define;
Than you can use them:
// use loaders
var fileContent = require("raw!"+__filename);
// use loaders automatically
var template = require("./my-template.jade");
var html = template({content: fileContent});
// use require.context
var directoryRequire = require.context("raw!./subdir");
var txtFile = directoryRequire("./aFile.txt");
// use require.ensure
require.ensure(["./someFile.js"], function(require) {
var someFile = require("./someFile.js");
});
// use AMD define
require.define(["./aDep"], function(aDep) {
aDep.run();
});
// use AMD require
require(["./bDep"], function(bDep) {
bDep.run();
});
require("enhanced-require/install")
enables support for all modules.Copyright (c) 2012 Tobias Koppers
FAQs
Enhance the require function in node.js with support for loaders which preprocess files and really async require (AMD). Enables Hot Code Replacement.
The npm package enhanced-require receives a total of 194 weekly downloads. As such, enhanced-require popularity was classified as not popular.
We found that enhanced-require 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.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.