How to use @rollup/plugin-multi-entry - 1 common examples

To help you get started, we’ve selected a few @rollup/plugin-multi-entry 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 ngnjs / NGN / test / prepareKarmaBrowserSuite.js View on Github external
async function build () {
  const bundle = await rollup.rollup({
    input,
    external,
    plugins: [multi()]
  })

  // const { output } = await bundle.generate(outputOptions)

  await bundle.write(outputOptions)

  // Override the sourcemapping to work w/ CJS
  const content = /* `import NGN from './.browser/ngn-${pkg.version}.min.js'\n` + */fs.readFileSync(file)
    .toString()
    .replace("require('source-map-support/register.js');", '\n') // Not supported by browserify
    .replace(/var NGN\s+=\s+_interop.*require.*\n?/i, '') // Remove NGN reference so it can be included from the appropriate build file at runtime.
    .replace(/const\s+(.*)\s+?=\s+?JSON.parse\(fs.readFileSync\(.*endpoints/gi, 'const $1 = __ENDPOINTS__;') // This replacement is done to add the appropriate endpoints from package.json. Browserify cannot resolve the file at runtime, so it must be prebuilt (see prep script below).

  // .replace(/(var NGN\s+=\s+_interop.*require\(['|"])(.*)(['|"].*\n?)/, `$1./.browser/ngn-${pkg.version}.min.js$3`)
  // .replace('.node/index.js', `.browser/ngn-${pkg.version}.min.js`)
  // .replace("require('source-map-support/register.js');", "var sourcemap = require('source-map-support');\nsourcemap.install();\n")

@rollup/plugin-multi-entry

Use multiple entry points for a bundle

MIT
Latest version published 1 year ago

Package Health Score

75 / 100
Full package analysis

Popular @rollup/plugin-multi-entry functions