Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

168
Visualizações
Including multiple JS files in the Loader for Webpack 5

I am working on an AFRAME web application, trying to include multiple components I am using that have already been created a distributed through the AFRAME community. Now I know how to import modules from other JS files but AFRAME isn't built to use require or import unless I use webpack since everything needs to load before the HMTL does. Currently in my webpack.dev.config file I have my loader here

module: {
        rules:[
            {
                test: /\.(png|jpg)$/,
                type: 'asset',
                parser: {
                    dataUrlCondition:{
                        maxSize: 3 * 1024,
                    },
                },
            },
            {
                test: /\.js$/,
                exclude: /node_modules/,
                include: ['src', require.resolve('aframe-physics-system')],
                use:{
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/env'],
                        plugins: ['@babel/plugin-proposal-class-properties'],
                    },
                },
            },
        ],
    }

Which I am requiring one of the current components that I am using from the community. But I would like to include more because I want to be able to use the config loader to load all the components that way so I don't have to go an download each script and actually keep it inside my source project. I am more than likely overthinking this, but how/can the include property be formatted to allow multiple require.resolve() calls?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Yup I was overthinking.

                test: /\.js$/,
                exclude: /node_modules/,
                include: ['src', require.resolve('aframe-physics-system'), require.resolve('another module')],
                use:{
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/env'],
                        plugins: ['@babel/plugin-proposal-class-properties'],
                    },
                },
            },
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda