How to use node-libs-browser - 2 common examples

To help you get started, we’ve selected a few node-libs-browser 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 Vizzuality / gfw / config / webpack / shared.js View on Github external
const extensionGlob = `**/*{${settings.extensions.join(',')}}*`;
const entryPath = join(settings.source_path, settings.source_entry_path);
const packPaths = sync(join(entryPath, extensionGlob));

const entry = packPaths.reduce((map, entryParam) => {
  const localMap = map;
  const namespace = relative(join(entryPath), dirname(entryParam));
  localMap[
    join(namespace, basename(entryParam, extname(entryParam)))
  ] = resolve(entryParam);
  return localMap;
}, {});

const nodeLibsBrowser = require('node-libs-browser');

nodeLibsBrowser.assert = require.resolve('browser-assert');
nodeLibsBrowser.util = require.resolve('util');

module.exports = {
  entry,
  output: {
    path: output.path,
    publicPath: output.publicPath,
    filename: '[name].[hash].js',
    chunkFilename: '[name].[hash].js'
  },
  module: {
    rules: sync(join(loadersDir, '*.js')).map(loader => require(loader))
  },
  plugins: [
    new webpack.EnvironmentPlugin(JSON.parse(JSON.stringify(env))),
    // entry points are required to work with webpacker (rails)
github Vizzuality / gfw / config / webpack / shared.js View on Github external
const entryPath = join(settings.source_path, settings.source_entry_path);
const packPaths = sync(join(entryPath, extensionGlob));

const entry = packPaths.reduce((map, entryParam) => {
  const localMap = map;
  const namespace = relative(join(entryPath), dirname(entryParam));
  localMap[
    join(namespace, basename(entryParam, extname(entryParam)))
  ] = resolve(entryParam);
  return localMap;
}, {});

const nodeLibsBrowser = require('node-libs-browser');

nodeLibsBrowser.assert = require.resolve('browser-assert');
nodeLibsBrowser.util = require.resolve('util');

module.exports = {
  entry,
  output: {
    path: output.path,
    publicPath: output.publicPath,
    filename: '[name].[hash].js',
    chunkFilename: '[name].[hash].js'
  },
  module: {
    rules: sync(join(loadersDir, '*.js')).map(loader => require(loader))
  },
  plugins: [
    new webpack.EnvironmentPlugin(JSON.parse(JSON.stringify(env))),
    // entry points are required to work with webpacker (rails)
    new WebpackAssetsManifest({

node-libs-browser

The node core libs for in browser usage.

MIT
Latest version published 5 years ago

Package Health Score

58 / 100
Full package analysis

Popular node-libs-browser functions

Similar packages