How to use webpack-inject-plugin - 2 common examples

To help you get started, we’ve selected a few webpack-inject-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / pwa-buildpack / lib / WebpackTools / plugins / RootComponentsPlugin.js View on Github external
injectRootComponentLoader() {
        debug('applying InjectPlugin to create global');
        new InjectPlugin(() => this.buildFetchModule()).apply(this.compiler);
    }
github project-yuki / YUKI / .electron-vue / webpack.main.config.js View on Github external
},
  node: {
    __dirname: process.env.NODE_ENV !== "production",
    __filename: process.env.NODE_ENV !== "production"
  },
  output: {
    filename: "[name].js",
    libraryTarget: "commonjs2",
    path: path.join(__dirname, "../dist/electron")
  },
  plugins: [
    new InjectPlugin.default(
      function() {
        return "process.env.DEBUG = 'yuki:*';process.env.DEBUG_COLORS = '1';";
      },
      { entryOrder: InjectPlugin.ENTRY_ORDER.First }
    ),
    new webpack.NoEmitOnErrorsPlugin()
  ],
  resolve: {
    extensions: [".ts", ".js", ".json", ".node"]
  },
  target: "electron-main"
};

/**
 * Adjust mainConfig for development settings
 */
if (process.env.NODE_ENV !== "production") {
  mainConfig.plugins.push(
    new webpack.DefinePlugin({
      __static: `"${path.join(__dirname, "../static").replace(/\\/g, "\\\\")}"`

webpack-inject-plugin

A webpack plugin to dynamically inject code into the bundle.

MIT
Latest version published 3 years ago

Package Health Score

44 / 100
Full package analysis