Giter Site home page Giter Site logo

Not working in nuxt 2 about lite-youtube HOT 4 CLOSED

MooseSaeed avatar MooseSaeed commented on July 26, 2024
Not working in nuxt 2

from lite-youtube.

Comments (4)

justinribeiro avatar justinribeiro commented on July 26, 2024 1

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).

from lite-youtube.

MooseSaeed avatar MooseSaeed commented on July 26, 2024 1

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.

from lite-youtube.

justinribeiro avatar justinribeiro commented on July 26, 2024

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.

from lite-youtube.

MooseSaeed avatar MooseSaeed commented on July 26, 2024

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.

from lite-youtube.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.