Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
How do I access a webpack plugin from node?

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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!