Skip to content

PWA Venia Magento 2 error

Upon running yarn build on building Venia store for Magento 2, I get this error:

 ERROR in ./node_modules/photoswipe/dist/photoswipe-lightbox.esm.js 381:24
    Module parse failed: Unexpected token (381:24)
    You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
    |     }
    | 
    >     this._filters[name]?.push({ fn, priority });
    |     this._filters[name]?.sort((f1, f2) => f1.priority - f2.priority);
    | 
     @ ./src/components/ProductImageGrid/useLightbox.js 2:0-76 17:23-41
     @ ./src/components/ProductImageGrid/productImageGrid.js
     @ ./src/components/ProductImageGrid/index.js
     @ ./src/components/ProductFullDetail/productFullDetail.js
     @ ./src/components/ProductFullDetail/productWrapper.js
     @ ./src/overrides/venia-ui/RootComponents/Product/product.js
     @ ./node_modules/@magento/venia-ui/lib/RootComponents/Product/index.js
     @ (webpack)-inject-plugin/dist/webpack-inject-plugin.loader.js?id=webpack-inject-module-1
     @ multi (webpack)-inject-plugin/dist/webpack-inject-plugin.loader?id=webpack-inject-module-1 (webpack)-inject-plugin/dist/webpack-inject-plugin.loader?id=webpack-inject-module-2 ./src/index.js
    
    ERROR in ./node_modules/photoswipe/dist/photoswipe.esm.js 954:36
    Module parse failed: Unexpected token (954:36)
    You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
    |   /** @returns {HTMLImageElement | HTMLDivElement | null | undefined} */
    |   getPlaceholderElement() {
    >     return this.content.placeholder?.element;
    |   }
    | 
     @ ./src/components/ProductImageGrid/useLightbox.js 31:24-64
     @ ./src/components/ProductImageGrid/productImageGrid.js
     @ ./src/components/ProductImageGrid/index.js
     @ ./src/components/ProductFullDetail/productFullDetail.js
     @ ./src/components/ProductFullDetail/productWrapper.js
     @ ./src/overrides/venia-ui/RootComponents/Product/product.js
     @ ./node_modules/@magento/venia-ui/lib/RootComponents/Product/index.js
     @ (webpack)-inject-plugin/dist/webpack-inject-plugin.loader.js?id=webpack-inject-module-1
     @ multi (webpack)-inject-plugin/dist/webpack-inject-plugin.loader?id=webpack-inject-module-1 (webpack)-inject-plugin/dist/webpack-inject-plugin.loader?id=webpack-inject-module-2 ./src/index.js

Can somebody help me out here ?

Thank you !