Using pug-loader how can I make some vairable accessible to all pug/jade files. For example in express app I could do:
app.locals.assetPath = path.resolve('public/assets');
and the variable assetPath
would be available in all jade files. But with webpack I am not able to do the same.
In my webpack.config.js
I tried following but could not get work:
{
test: /.pug$/,
loader: 'pug',
query: {
root: path.join(__dirname, 'src/app'),
/*globals: {assetPath: '/hard/coded/value'}*/ //WILL NOT WORK
/*locals: {assetPath: '/hard/coded/value'}*/ //WILL NOT WORK
/*locals: {assetPath: '/hard/coded/value'}, globals: ['assetPath']*/ //WILL NOT WORK
}