Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
Agregar otro archivo de entrada al paquete web sin inyectarlo en el archivo html

Estoy usando CRA con CRACO para agregar otro archivo de entrada a la configuración del paquete web,

Aquí está el código

 module.exports = { webpack: { configure: (webpackConfig, {paths}) => { return { ...webpackConfig, entry: { main: paths.appIndexJs, content: './src/chromeServices/DOMEvaluator.ts', }, } }, }, }

Sin embargo, no necesito que este archivo se inyecte en el archivo HTML, ¿es posible hacerlo?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Es muy fácil hacerlo. CRACO y, en última instancia, CRA hacen uso de html-webpack-plugin para generar su archivo HTML y agregar las etiquetas de script requeridas. Tendrá que hacer uso del filtrado de fragmentos para lograr esto.

 const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { webpack: { configure: (webpackConfig, {paths}) => { // 1. Find instance of HTML Webpack plugin const pluginInstance = webpackConfig.plugins.find( webpackPlugin => webpackPlugin instanceof HtmlWebpackPlugin ); // 2. Define the exclusion or inclusion if (pluginInstance) { pluginInstance.options.excludeChunks = ['content']; // Or, alternately, use include only feature // pluginInstance.options.chucks = ['main']; } return { ...webpackConfig, entry: { main: paths.appIndexJs, content: './src/chromeServices/DOMEvaluator.ts', }, } }, }, };
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!