How to use the webpack.LoaderOptionsPlugin function in webpack

To help you get started, we’ve selected a few webpack 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 rstacruz / webpack-starter-kit / config / webpack.js View on Github external
stats: 'errors-only',
    devServer: { stats: 'errors-only' }
  }

  if (DEBUG) {
    config.plugins = [
      ...config.plugins,

      // LiveReload in development
      new LiveReloadPlugin({
        appendScriptTag: true
      }),

      // Debug mode for old webpack plugins
      new webpack.LoaderOptionsPlugin({
        debug: true
      })
    ]
  }

  return config
}
github MyCryptoHQ / MyCrypto / webpack_config / webpack.base.js View on Github external
}),
    new HtmlWebpackPlugin({
      title: config.title,
      template: path.resolve(__dirname, '../common/index.html'),
      inject: true,
      filename: _.outputIndexPath
    }),
    new CopyWebpackPlugin([
      {
        from: _.cwd('./static'),
        // to the root of dist path
        to: './'
      }
    ]),

    new webpack.LoaderOptionsPlugin(_.loadersOptions())
  ],
  target: _.target
};
module.exports = webpackConfig;
github jancarloviray / graphql-react-starter / config / client.webpack.config.js View on Github external
function plugins() {
  log('Enable common plugins: Define, LoaderOptions, HtmlWebpack, CommonsChunk')
  const common = [
    // map variables
    new webpack.DefinePlugin(clientConfig.globals),

    new webpack.LoaderOptionsPlugin({
      options: {
        context: __dirname,
        postcss: [
          cssnano({
            autoprefixer: {
              add: true,
              remove: true,
              browsers: ['last 2 versions']
            },
            discardComments: {
              removeAll: true
            },
            discardUnused: false,
            mergeIdents: false,
            reduceIdents: false,
            safe: true,
github dialogflow / dialogflow-javascript-client / webpack.config.js View on Github external
module.exports = function(env) {
  if (!env) {
    env = {};
  }

  // handle minification
  if (env && env.compress) {
    plugins.push(
      new webpack.LoaderOptionsPlugin({
        minimize: true,
        debug: false
      })
    );

    plugins.push(
      new webpack.optimize.UglifyJsPlugin({
        compress: {
          warnings: true,
          keep_fnames: true
        },
        mangle: {
          keep_fnames: true
        }
      })
    );
github marclaval / optimize-angular-app / webpack-jit.js View on Github external
// Reference: https://github.com/angular/angular-cli/tree/master/packages/webpack
    new aotplugin.AotPlugin({
      tsConfigPath: './tsconfig-aot.json',
      entryModule: 'app/module#AppModule',
      skipCodeGeneration: true
    }),

    // Inject script and link tags into html files
    // Reference: https://github.com/ampedandwired/html-webpack-plugin
    new HtmlWebpackPlugin({
      template: './public/treeshaking-webpack/index.html',
      chunksSortMode: 'dependency'
    }),

    new webpack.LoaderOptionsPlugin({
      debug: false,
      minimize: true
    }),

    // Reference: http://webpack.github.io/docs/list-of-plugins.html#noerrorsplugin
    // Only emit files when there are no errors
    new webpack.NoErrorsPlugin(),

    // Reference: http://webpack.github.io/docs/list-of-plugins.html#dedupeplugin
    // Dedupe modules in the output
    // TODO: reactivate once fixed, see https://github.com/webpack/webpack/issues/2644
    //new webpack.optimize.DedupePlugin(),

    // Reference: http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
    // Minify all javascript, switch loaders to minimizing mode
    new webpack.optimize.UglifyJsPlugin({
github granmoe / react-redux-saga-boilerplate / webpack.config.js View on Github external
optimizationLevel: 1
    },
    svgo: {},
    plugins: [] // add imagemin-mozjpeg plugin once https://github.com/sindresorhus/execa/issues/61 is available...and prob switch to image-webpack-loader
  })
]

if (IS_DEV) {
  plugins.push(
    new Webpack.HotModuleReplacementPlugin(),
    new Webpack.NamedModulesPlugin(),
    new DashboardPlugin()
  )
} else {
  plugins.push(
    new Webpack.LoaderOptionsPlugin({
      minimize: true,
      debug: false
    }),
    new Webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false,
        screw_ie8: true,
        conditionals: true,
        unused: true,
        comparisons: true,
        sequences: true,
        dead_code: true,
        evaluate: true,
        if_return: true,
        join_vars: true
      },
github storj / storjspace / webpack.renderer.config.js View on Github external
}
    )
  }
}

/**
 * Adjust rendererConfig for production settings
 */
if (process.env.NODE_ENV === 'production') {
  rendererConfig.devtool = ''

  rendererConfig.plugins.push(
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': '"production"'
    }),
    new webpack.LoaderOptionsPlugin({
      minimize: true
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      }
    })
  )
}

module.exports = rendererConfig
github d4rkr00t / aik / src / webpack / plugins.js View on Github external
export function pluginsDev(template: string | false): Array {
  return [
    new webpack.LoaderOptionsPlugin({ debug: true }),
    new webpack.DefinePlugin({ "process.env.NODE_ENV": '"development"' }),
    new webpack.HotModuleReplacementPlugin(),
    htmlWebpackPlugin(template)
  ];
}
github grommet / grommet-cli / templates / docs / webpack.config.babel.js View on Github external
];
  devConfig.devServer = {
    compress: true,
    clientLogLevel: 'none',
    contentBase: path.resolve('./dist'),
    publicPath: '/',
    quiet: true,
    hot: true,
    watchOptions: {
      ignored: /node_modules/
    },
    historyApiFallback: true
  };
}

plugins.push(new webpack.LoaderOptionsPlugin(loaderOptionsConfig));

const baseConfig = Object.assign({
  entry: './src/js/index.js',
  output: {
    path: path.resolve('./dist'),
    filename: 'index.js',
    publicPath: '/'
  },
  resolve: {
    extensions: ['.js', '.scss', '.css', '.json']
  },
  plugins,
  node: {
    fs: 'empty',
    net: 'empty',
    tls: 'empty'
github grommet / grommet-cli / templates / basic / webpack.config.babel.js View on Github external
];
  devConfig.devServer = {
    compress: true,
    clientLogLevel: 'none',
    contentBase: path.resolve('./dist'),
    publicPath: '/',
    quiet: true,
    hot: true,
    watchOptions: {
      ignored: /node_modules/
    },
    historyApiFallback: true
  };
}

plugins.push(new webpack.LoaderOptionsPlugin(loaderOptionsConfig));

export default Object.assign({
  entry: './src/js/index.js',
  output: {
    path: path.resolve('./dist'),
    filename: 'index.js',
    publicPath: '/'
  },
  resolve: {
    extensions: ['.js', '.scss', '.css', '.json']
  },
  plugins,
  node: {
    fs: 'empty',
    net: 'empty',
    tls: 'empty'