How to use @pkgr/umd-globals - 3 common examples

To help you get started, we’ve selected a few @pkgr/umd-globals 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 1stG / configs / packages / rollup-config / config.js View on Github external
return pkgFormats.map(format => {
      const isEsVersion = /^es(\d+|next)$/.test(format) && format !== 'es5'
      return {
        input: pkgInput,
        output: {
          file: path.resolve(
            pkgPath,
            `${pkgOutputDir}${format}${prod ? '.min' : ''}.js`,
          ),
          format: isEsVersion ? 'esm' : format,
          name: pkgGlobals[name] || upperCamelCase(normalizePkg(name)),
          globals,
          exports,
        },
        external: id =>
          external.some(pkg => id === pkg || id.startsWith(pkg + '/')),
        onwarn,
        plugins: [
          alias({
            resolve: EXTENSIONS.concat(ASSETS_EXTENSIONS),
            entries: Array.isArray(aliases)
              ? aliases.map(({ find, replacement }) => ({
                  find: tryRegExp(find),
                  replacement,
                }))
              : Object.entries(aliases).map(([find, replacement]) => ({
                  find: tryRegExp(find),
github 1stG / configs / packages / rollup-config / config.js View on Github external
const pkgGlobals = external.reduce((pkgGlobals, pkg) => {
      if (pkgGlobals[pkg] == null) {
        pkgGlobals[pkg] = upperCamelCase(normalizePkg(pkg))
      }
      return pkgGlobals
    }, globals)
github 1stG / configs / packages / rollup-config / config.js View on Github external
aliases = [],
  sourceMap = false,
  postcss: postcssOpts,
  prod = process.env.NODE_ENV === PRODUCTION,
} = {}) => {
  const pkgsPath = path.resolve(
    typeof monorepo === 'string' ? monorepo : 'packages',
  )

  if (monorepo !== false) {
    monorepo = fs.existsSync(pkgsPath)
  }

  const pkgs = monorepo ? fs.readdirSync(pkgsPath) : ['']

  const globals = getGlobals({
    globals: umdGlobals,
  })

  const configs = flatMap(pkgs, pkg => {
    const pkgPath = path.resolve(monorepo ? pkgsPath : '', pkg)
    const srcPath = path.resolve(pkgPath, 'src')

    let pkgInput = input
    let pkgOutputDir = outputDir

    if (!fs.existsSync(srcPath) && pkgInput == null) {
      pkgInput = 'index'
    }

    pkgInput = tryExtensions(path.resolve(pkgPath, pkgInput || 'src/index'))

@pkgr/umd-globals

Union collections of umd globals mappings

MIT
Latest version published 2 years ago

Package Health Score

49 / 100
Full package analysis