Static GitHub Issues

[2373] Having a script tag inside page does not warn/error

prev: Wrong _uid for this in the transition hooks
next: Nuxt build hangs

First of all great job guys! I accidentally had a script tag inside a .vue file which I didn't notice. With the vue webpack template, you get a warning/error from the vue-template-compiler I think that there shouldn't be a script tag inside the .vue file.

Steps to reproduce: 1. Initialize nuxt from official nuxt template and run it locally 2. Create a page inside pages dir which contains a script tag

<template>
  <div class="copyright">
    &copy;
    <script>
      document.write(new Date().getFullYear())
    </script>, Designed by xxx
  </div>
</template>

<script>
  export default {
    name: 'about-us'
  }
</script>

<style>

</style>
  1. Modify some text in the page.

What is expected? Nuxt will warn/give an error that you shouldn't have a script tag inside a .vue file.

What is actually happening? Page hot reloads with no error but outputs only the script tag result. In this case, the current year.

I know this might sound dumb, but might be confusing for beginners who accidentally drop some scripts without knowing. After that, it might be hard to track what is happening.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2065">#c2065</a>)</em></sub></div>