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

152
Views
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
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!