B
B
BonBon Slick2017-10-12 17:18:40
Vue.js
BonBon Slick, 2017-10-12 17:18:40

How to include external js file in .vue file?

If you use require() or import it looks in node.js modules .
Tried with relative path

</template>
<script src="../node_server/index.js"></script>
<script>
    var socket = window.IO; // initialize socket connection
    export default {
        props: [

However, it doesn't even connect. Laravel 5 structure, component files are resources/assets/js/components, entry point for node resources/assets/js/node_server/index.js Might be worth putting in public folder where shared can be accessed from root directiry
<script src="{{ hostname }}/js/node/index.js"></script>

Did not help.
Can you please tell me how to connect?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2017-10-12
@BonBonSlick

Tried like this : import '../node_server'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question