Closed felixgotama closed 3 weeks ago
I have a problem. Can you help me?
Failed to compile. ./node_modules/react-xml-viewer/dist/index.es.js 2274:16 Module parse failed: Unexpected token (2274:16) File was processed with these loaders:
- ./node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | function Zl(e, t) { | var r = typeof e;
return t = t ?? zl, !!t && (r == "number" || r != "symbol" && Jl.test(e)) && e > -1 && e % 1 == 0 && e < t; | } | var Ql = Zl, Error: error building at STEP "RUN npm run build": error while running runtime: exit status 1
Hey! I just solved this issue.
Turns out react-xml-viewer uses modern JavaScript features like the nullish coalescing operator (??) and optional chaining (?.), which older browsers don't support without transpilation.
To fix it, you need to add these Babel plugins:
@babel/plugin-transform-nullish-coalescing-operator @babel/plugin-transform-optional-chaining
If you're still having trouble, just share your Webpack and Babel configs, and we'll figure it out together!
I have a problem. Can you help me?
Failed to compile. ./node_modules/react-xml-viewer/dist/index.es.js 2274:16 Module parse failed: Unexpected token (2274:16) File was processed with these loaders: