Closed MooseSaeed closed 1 year ago
this.domRefImg?.fallback?.setAttribute('alt',
${this.videoPlay}: ${this.videoTitle}
);
Whichever version of webpack you're using doesn't understand optional chaining. That's what the error message is saying, and isn't an issue with lite-youtube. Consult https://github.com/webpack/webpack/issues/10227 for additional information.
this.domRefImg?.fallback?.setAttribute('alt',
${this.videoPlay}: ${this.videoTitle}
);Whichever version of webpack you're using doesn't understand optional chaining. That's what the error message is saying, and isn't an issue with lite-youtube. Consult webpack/webpack#10227 for additional information.
Nuxt 2 uses webpack 4 and of course it understands optional chaining, Im using it throughout my entire codebase for 5 websites.
of course it understands optional chaining
It understands first party code with chaining, not third party modules. lite-youtube is a third party ESM module; you have to tell webpack that (which is why it's saying "I don't have a loader for this" and why it chokes on the optional chaining because it's not applying the same build config for your code as that module).
Just in case anyone using nuxt 2 encountered this issue, it can be resolved by adding the package to build.transpile
array in nuxt.config.js
file.
{
build: {
transpile: ['@justinribeiro/lite-youtube']
}
}
Thanks @justinribeiro for such an awesome package.
We are using version 0.9.1 and it works fine, but we're having trouble with youtube-nocookie and the hell of un-used javascript it brings. After upgrading to v1.5.0, I'm getting this error in Nuxt 2 project:
And we're just using it like this: