Skip to content

Script inside SFC results in 'component is not defined' error for UMD. #16

@cbeninati

Description

@cbeninati

Steps to reproduce

  1. Pull hello-vue-components from GitHub
  2. Runnpm install
  3. Update src/HelloA.vue (see changes below)
  4. Run npm run build
  5. View the output ./dist/demo.html in the browser (Chrome)
  6. Errors like the Dickens!!! (single error, screenshot below)

Screen Shot 2019-04-12 at 11 22 54 AM

Change to the SFC

...
<!-- HelloA.vue -->

<script>
  export default {
    name: 'hello-a',
    data() {
      return {
        name: 'HelloA',
      }
    },
  }
</script>
...

Complete SFC

<!-- HelloA.vue -->

<template>
  <div class="hello">
   {{ name }}
  </div>
</template>

<script>
  export default {
    name: 'hello-a',
    data() {
      return {
        name: 'HelloA',
      }
    },
  }
</script>

<style>
.hello {
  color: orange;
}
</style>

<meta>
{
  "description": "A component that says \"HelloA\" with orange text."
}
</meta>

<example>
  <!-- No props or content are necessary. -->
  <hello-a></hello-a>
</example>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions