Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

170
Vistas
Is it possible to expose Rollup library in a variable?

Is it possible to expose Rollup library in a variable like this one:

var libName=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};[...]

I'm trying to port some legacy webpack app (ejected create-react-app with output.library.type = 'var') to Rollup, but I can't find appropriate option in rollup docs.

  • output.library.type in Webpack docs

My Rollup/Vite config looks like this:

export default defineConfig(({ mode }) => {
  process.env = {
    ...process.env,
    ...loadEnv(mode, process.cwd())
  };

  return {
    base: process.env.VITE_BASE_URL,
    build: {
      rollupOptions: {
        preserveEntrySignatures: 'strict',
        input: {
          [Entry.ENTRY_1]: path.resolve(__dirname, `src/${Entry.ENTRY_1}.ts`),
          [Entry.ENTRY_2]: path.resolve(__dirname, `src/${Entry.ENTRY_2}.ts`)
        },
        output: [
          {
            format: 'system',
            entryFileNames
          },
          {
            format: 'module',
            entryFileNames
          },
          // any of these expose as var moduleName = ... like webpack does
          {
            format: 'amd',
            name: 'moduleName',
            entryFileNames
          },
          {
            format: 'commonjs',
            name: 'moduleName',
            entryFileNames
          }
        ]
      }
    },
    plugins: [react(), mode === 'production' && viteExternalsPlugin(sharedDependency)]
  };
});
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda