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

100
Vistas
Externals webpack scripts with Vue plugins

I have MFE and want to use webpack externals. When I use just Vue and Vuex all works great.

Example:

Webpack: 

{
        ....
        externals: {
            vue: 'Vue',
            'vue-router': 'VueRouter',
            vuex: 'Vuex'
        },
        ....
        plugins: [
             new CopyWebpackPlugin(...), // Just copy files like (vue.min.js, etc) from node_modules to assets folder. 
        ]
 }

I have a library that was written a long time ago for Vue2 and I can't do it 'external'. For this library, I have commonjs module and umd.

enter image description here enter image description here

I tried to use commonjs module and append library that exported with module.exports and also umd. Set libraryTarget to 'umd' nothing works.

My attempts:

{
    externals: {
        vue: 'Vue',
        'vue-router': 'VueRouter',
        vuex: 'Vuex',
        'ui-essentials': 'UIEssentials'
    },

    externals: {
        vue: 'Vue',
        'vue-router': 'VueRouter',
        vuex: 'Vuex',
        'ui-essentials': {
            commonjs: 'UIEssentials',
            commonjs2: 'UIEssentials',
            amd: 'UIEssentials',
        }
    },

    externals: {
        vue: 'Vue',
        'vue-router': 'VueRouter',
        vuex: 'Vuex',
        'ui-essentials': {
            root: ['ui-essentials', 'UIEssentials']
        }
    },

}

I have tried a lot of stuff but the result is the same. For example when I use commonjs I receive error 'module is not found'. When I use just 'ui-essentials': 'UIEssentials' I receive an error that UIEssentials is not found, etc.

But inside of window['ui-essentials'] there is UIEssentials object, but it should be available in window.UIEssentials like this as I understand correctly.

In app.js file, I try to call import the library like import { UIEssentials } from 'ui-essentials';

Without 'externals' the library works well but I need to use externals because I should share a library between MFE.

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