I have several npm packages with client-side scripts I want to include to separate pages of my Nuxt.js project. I have tried to do that with:
<script>
export default {
head: {
script: [
{ src: "gojs/release/go.js", type: "text/javascript" }
]
},
// ...
}
</script>
but received 404 (Not Found) error. What is correct way to do that?
/assets/static/gojs/release/go.js), which will make them available at the root (/). Then in your.vue, thesrcurl should be prefixed with/(/gojs/release/go.js).node_modulesso when I update packages with npm - they will be updated.import go from 'gojs') and using it in your code are all you need to do for the build to include that dependency. See this demo