Closed nicholascloud closed 7 years ago
@nicholascloud The LoaderOptionsPlugin
was mainly necessary in the webpack 1 => webpack 2 transition phase, bc since webpack 2 it's disallowed to have custom props on the webpack.config.js
{Object}
directly, in this case transforms
. I can't give you a guarantee for this 😛, but normally this should live in module.rules[i].options
now.
webpack.config.js
{
loader: 'transform-loader',
options: {
transforms: [
(file) => {
return through((buffer) => {
return this.queue(
buffer
.split('')
.map((chunk) => String.fromCharCode(127-chunk.charCodeAt(0))))
.join('')
}),
() => this.queue(null)
}
]
}
}
@michael-ciniawsky Awesome, thanks for the clarification.
@nicholascloud if you are using this loader, could you please verify 😁 😛 ?
@michael-ciniawsky Here is my configuration, and everything works great:
// Transform Node.js fs lib calls to be inline strings.
// @see: https://github.com/webpack-contrib/transform-loader
{
test: /\.js$/,
exclude: /node_modules|vendor/,
loader: 'transform-loader/cacheable',
enforce: 'post',
options: {
brfs: true,
// @see: https://github.com/webpack-contrib/transform-loader#webpack-2x-config-example
// @see: https://github.com/webpack-contrib/transform-loader/issues/20
transforms: [
function (/*file*/) {
return through((buffer) => {
return this.queue(
buffer.split('')
.map((chunk) => String.fromCharCode(127-chunk.charCodeAt(0))))
.join('')
}, () => this.queue(null))
}
]
}
}
@nicholascloud Thx 👍 Mind sending a quick PR with docs update :D ? Otherwise I do it later 🙃
@michael-ciniawsky For the README file? Yeah, I'll set up a PR.
Yep, 💯 thx in advance 👍
What does this actually do, and why do I need it in my configuration?