Webpack Compile script which are not in JS file but in HTML <script>

Viewed 16

I am using craft cms with vuejs, It would be awesome if I could write following in banner.twig file and webpack compiles it:

<script>
  import { createApp } from 'vue'
  import Banner from './banner.vue'
  const app = createApp({
    components: {
      Banner,
    },
  })
  app.mount('#app')
</script>

Is it possible to do so?

My main aim is not to create a js file for every component to declare components or not import every component in index.js file

0 Answers
Related