Parcel build is incorrect in production build but correct in development build

27 Views Asked by At

I have built a react widget and built it using parcel. Following are my scripts inside package.json-

 "scripts": {
    "start": "parcel",
    "build": "react-app-rewired build",
    "test": "react-app-rewired test",
    "eject": "react-scripts eject",
    "build:widget": "parcel build src/index.tsx"
  },

I am using "parcel-bundler": "^1.12.5" and "parcel":"^2.12.0"

The development build has no issues and runs fine but the production build produces index.js file with below the content-

!function(){let $19e6947867ed8ed4$var$TEXT_ENCODER,$4c50b6ff9467b60f$var$TEXT_DECODER,$8b7a30ab099cf60f$var$_utf8Decoder,$ea68db18be937c4b$var$_userAgent,e,n,e,r,$a7729d8b25363d86$var$wallets,r,e,n,o,t,t,t,r,n,e,r,r,e,

As you can see we can see multiple declarations of variables above which on vscode says-

Cannot redeclare block-scoped variable 'e'.ts(2451)
let e: any
Tokenization is skipped for long lines for performance reasons. This can be configured via the editor.maxTokenizationLineLength

. This problem is in many places inside the file.

I am expecting a clean index.js file like in the development build.

0

There are 0 best solutions below