Enables you to add Pug like extending/ inheritance cabilites to any file type
To begin, you'll need to install webpack-file-inherit
:
npm install --save-dev webpack-file-inherit
Then add the loader to your webpack
config for a specific file type. For example:
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.js/i,
loader: 'webpack-file-inherit',
},
],
},
};
This loader enables you to exends files is a simlier way that pug templting engine do you have to define blocks first
Parent.js
var x = 16;
/* @block secondValue */
var y = 15;
/* @terminate block */
console.log(x*y);
Child.js
/* @extends "./Parent.js" */
/* @block secondValue */
var y = 0;
/* @terminate block */
bunding the Child.js will result this file
var x = 16;
var y = 0;
console.log(x*y);
Please take a moment to read our contributing guidelines if you haven't yet done so.