
Product
A New Overview in our Dashboard
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
transform-loader
Advanced tools
npm i transform-loader --save
Pass the module name as query parameter.
var x = require("!transform-loader?brfs!./file.js");
var x = require("!transform-loader/cacheable?brfs!./file.js"); // cacheable version
If you pass a number instead it will take the function from this.options.transforms[number]
.
module.exports = {
module: {
rules: [
{
loader: "transform-loader?brfs",
enforce: "post"
},
{
test: /\.coffee$/,
loader: "transform-loader/cacheable?coffeeify"
},
{
test: /\.weirdjs$/,
loader: "transform-loader?0"
}
]
},
plugins: [
new webpack.LoaderOptionsPlugin({
options: {
transforms: [
function(file) {
return through(function(buf) {
this.queue(buf.split("").map(function(s) {
return String.fromCharCode(127-s.charCodeAt(0));
}).join(""));
}, function() { this.queue(null); });
}
]
}
})
]
};
module.exports = {
module: {
postLoaders: [
{
loader: "transform-loader?brfs"
}
]
loaders: [
{
test: /\.coffee$/,
loader: "transform-loader/cacheable?coffeeify"
},
{
test: /\.weirdjs$/,
loader: "transform-loader?0"
}
]
},
transforms: [
function(file) {
return through(function(buf) {
this.queue(buf.split("").map(function(s) {
return String.fromCharCode(127-s.charCodeAt(0));
}).join(""));
}, function() { this.queue(null); });
}
]
};
Say you have the following Node source:
var test = require('fs').readFileSync('./test.txt', 'utf8');
After npm install transform-loader brfs --save
, add the following loader to your config:
module.exports = {
context: __dirname,
entry: "./index.js",
module: {
loaders: [
{
test: /\.js$/,
loader: "transform-loader?brfs"
}
]
}
}
The loader is applied to all JS files, which can incur a performance hit with watch tasks. So you may want to use transform-loader/cacheable?brfs
instead.
Juho Vepsäläinen |
Joshua Wiens |
Kees Kluskens |
Sean Larkin |
FAQs
transform loader for webpack
The npm package transform-loader receives a total of 24,997 weekly downloads. As such, transform-loader popularity was classified as popular.
We found that transform-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.