justinribeiro / lite-youtube

The fastest little YouTube web component on this side of the internet. The shadow dom web component version of Paul's lite-youtube-embed.
https://www.npmjs.com/package/@justinribeiro/lite-youtube
MIT License
836 stars 63 forks source link

Webpack Error #58

Closed ashfaq-shamsudeen closed 2 years ago

ashfaq-shamsudeen commented 2 years ago

ModuleParseError: Module parse failed: Unexpected token (224:23) 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.domRefImg.fallback.src = posterUrlJpeg; | this.domRefImg.fallback.setAttribute('aria-label', ${this.videoPlay}: ${this.videoTitle}); this.domRefImg?.fallback?.setAttribute('alt', ${this.videoPlay}: ${this.videoTitle}); | } | initIntersectionObserver() {

relevant snippet of webpack config:

{ test: /.(jpe?g|png|gif|svg)$/i, loader: 'file-loader', },

Anything missing here? Thanks!

justinribeiro commented 2 years ago

Answer is in your webpack output:

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

Specifically, webpack 4.x for has problems with optional chaining (the line it's pointing to in your output) because of the acorn dependency. You can either use the workaround in this thread or move to webpack 5. webpack/webpack#10227