Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

205
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda