Fixing the _Symbol$iterator ReferenceError
When using Nutrient Web SDK 1.9+ with certain build configurations, you encounter this runtime error:
ReferenceError: _Symbol$iterator4 is not definedCause
Your build tool’s polyfill transformations (Babel/core-js) conflict with the SDK’s internal code.
Solution
Update core-js and import polyfills explicitly before loading the SDK:
npm install core-js@^3.47.0 regenerator-runtimeAt the top of your entry file (index.js, main.ts, or App.jsx):
// These must be the first importsimport "core-js/stable";import "regenerator-runtime/runtime";
import NutrientViewer from "pspdfkit";
NutrientViewer.load({ container: "#pspdfkit", document: "document.pdf",}).then((instance) => { console.log("Nutrient loaded", instance);}).catch((error) => { console.error("Failed to load:", error.message);});If using Babel, configure babel.config.js:
module.exports = { presets: [ [ "@babel/preset-env", { useBuiltIns: "entry", corejs: "3.47", }, ], ],};Alternative: Exclude SDK from transpilation
Webpack
module.exports = { module: { rules: [ { test: /\.js$/, exclude: [/node_modules/, /pspdfkit/], use: "babel-loader", }, ], },};Vite
export default { optimizeDeps: { exclude: ["pspdfkit"], },};Still not working?
Check for multiple
core-jsversions:Terminal window npm ls core-jsClean install:
Terminal window rm -rf node_modules package-lock.jsonnpm installTest with a Nutrient catalog example to isolate environment issues.
Contact Support with your SDK version,
package.json, and bundler config.
Limitations
- Verified on Web SDK 1.9.1. Other versions not yet tested.
- Framework-specific integrations (Next.js, Nuxt, Angular CLI) require additional configuration.