A preprocessor is a tool parsing files and replacing a piece of text by another.
It is extensively used in the C language and in the Unix world in general.
/!\ This is still the early stage of development. preprocessor-loader can only replace __FILE__
and
__LINE__
as of this writing.
Let's say you have a javascript called index.js
like so:
1 'use strict;'
2 console.log('This is a log (__FILE__:__LINE__)');
Once preprocessed, it will produce:
1 'use strict;'
2 console.log('This is a log (index.js:2)');
{
test: /\.js$/,
exclude: /node_modules/
loader: 'preprocessor',
},