I would like to access a webpack plugin (defined in webpack config) from a nodule script, and the call a function on it.
Say in my webpack.config there's this:
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
// [...]
plugins: [
new BrowserSyncPlugin({
port: 5759,
proxy: {
target: 'http://dev.mysite.com/something',
},
files: [
"wp-content/themes/theme/css/*.css",
],
injectChanges: true,
}),
],
// [...]
Say that I also got a tasks.js like this:
const webpack = require('webpack');
const webpackConfig = require('./webpack.config');
const bundler = webpack(webpackConfig);
webpackConfig.plugins[1].browserSync.reload();
Well when I run node tasks.js nothing happens (browserSync won't reload).
So I'm wondering how to reach the 'real', running, browserSync (in this case, but could be any plugin) and call functions on it..
Any idea?