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

147
Vistas
Terser plugin throws Invalid syntax after code splitting in Webpack

I use TerserWebpackPlugin to compress JavaScript files in production mode. And it did work unless I added code splitting. The plugins starts to throw an error Invalid syntax: 96dd6cce9d985b84ae6a [main.js:75348,105].

And that's is content of 75348 line:

/******/                var href = "resources/" + chunkId + "." + __webpack_require__.h ? __webpack_require__.h() : fa5d2a76a3dcf571c28b + ".css";

Doesn't look to be incorrect.


Packages versions

"react": "^17.0.2",
"react-dom": "^17.0.2",
"terser-webpack-plugin": "^5.2.4",

Code:

const Page1 = React.lazy(() => import('@view/page1/Page1'));
const Page2 = React.lazy(() => import('@view/page2/Page2'));

// ...

return (
  <React.Suspense fallback={<LoadingPage/>}>
    {viewModel.activePage === Pages.Page1 && <Page1/>}
    {viewModel.activePage === Pages.Page2 && <Page2/>}
  </React.Suspense>
)

Webpack config of optimisation:

optimization: {
  minimize: isProd,
  minimizer: [
    new CssMinimizerPlugin(),
    new TerserPlugin({
      test: /.js$/i,
      extractComments: false,
      terserOptions: {
        output: { comments: false },
      },
    }),
  ]
},

What is wrong?


EDIT 1:

aliases:

resolve: {
  alias: {
    // need for react_core
    ...aliases,
    '@domain': path.resolve(__dirname, 'src/domain'),
    '@service': path.resolve(__dirname, 'src/service'),
    '@utils': path.resolve(__dirname, 'src/utils'),
    '@view': path.resolve(__dirname, 'src/view'),
    '@sass': path.resolve(__dirname, 'src/sass'),
    '@components': path.resolve(__dirname, 'src/components'),
    '@resources': path.resolve(__dirname, 'resources'),
  },
  extensions: ['.tsx', '.ts', '.js'],
},
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