Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

93
Views
Import default in Vue component not definied in DevTools console

Simple data example, constants.js

export default {
  name: "John Smith",
  age: 10
};

Import it on the Vue component, which renders correctly. But if I use the DevTools and type c in the console... c is undefined.

import c from "../constants/constants.js";

export default {
  name: "HelloWorld",
  computed: {
    myName() {
      debugger;
      // In DevTools, console... c is undefined
      // even though this clearly works
      return c.name;
    },
  },
};

I don't understand why?

Example: https://codesandbox.io/s/constantsimportreference-ud0d3e?file=/src/components/HelloWorld.vue:90-341

https://ud0d3e.csb.app/

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Modules are not exposed to the global scope (window) when transpiled.

If you really want to expose c in DevTools you'd have to do window.c = c; Be careful when referencing window as this will break when rendering server side or prerendering as window does not exist.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!