search

Home  >  Q&A  >  body text

javascript - How to configure a variable in the production environment of vue+webpack?

The current project has a form of url=AAA "/api/list-101.json". I hope that this AAA can take different values ​​according to different environments: "" or "xxxxx", for example, in Let him take "" when npm run dev, and take "xxxxx" when npm run build. How to configure it to achieve this?

習慣沉默習慣沉默2741 days ago724

reply all(1)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-24 11:40:54

    If you are using cli, you can judge based on process.env.NODE_ENV. This value is production when building and development when dev.

    reply
    0
  • Cancelreply