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

289
Vistas
How to use a js file from outside of create-react-app directory, with craco?

I'm using craco for my create-react-app and I'm trying to import a javascript file from another directory, external to the app src.

I've heard it is possible but haven't found anything in their documentation about this, at least not from what I've seen.

My app is built using React version 17.0.2, in case it might help.

Any idea how to acheive this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The solution for my question was to add this inside my craco.config.ts exported object:

https://github.com/facebook/create-react-app/issues/9127#issuecomment-646989707

You need to add this too in the root of the exported object(e.g: module.exports = { ...):

    webpack: {
        alias: {},
        plugins: {
            add: [], /* An array of plugins */
            remove: [],  /* An array of plugin constructor's names (i.e. "StyleLintPlugin", "ESLintWebpackPlugin" ) */
        },
        configure: webpackConfig => {
            const scopePluginIndex = webpackConfig.resolve.plugins.findIndex(
              ({ constructor }) => constructor && constructor.name === 'ModuleScopePlugin'
            );
      
            webpackConfig.resolve.plugins.splice(scopePluginIndex, 1);
            return webpackConfig;
        }
    },
about 4 years ago · Juan Pablo Isaza Denunciar
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