[英]Include js library in nuxt.config.js with Assets
I'm trying to include some javascript files but for some reason, I get this我正在尝试包含一些 javascript 文件,但由于某种原因,我明白了
" error in GET http://localhost:3000/assets/js/jquery-3.4.1.min.js net::ERR_ABORTED 404 (Not Found)
" GET http://localhost:3000/assets/js/jquery-3.4.1.min.js net::ERR_ABORTED 404 错误(未找到)
I don't know if this is the better way to Include the javascript file please if someone can help me out.如果有人可以帮助我,我不知道这是否是包含 javascript 文件的更好方法。
head: {
title: 'streamit',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' }
],
script: [
{ src: '/assets/js/jquery-3.4.1.min.js', type: 'text/javascript' },
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/images/favicon.ico' }
]
},
assets/ js/ jquery-3.4.1.min.js
assets/js/jquery-3.4.1.min.js
Try Like this and make sure static
folder and create js
floder inside it and put your jquery-3.4.1.min.js
file there.像这样尝试并确保
static
文件夹并在其中创建js
floder 并将您的jquery-3.4.1.min.js
文件放在那里。 In your nuxt.config.js
put:在你的
nuxt.config.js
放:
script: [
{ src: 'js/jquery-3.4.1.min.js' },
]
I fixed the issue by adding a new folder called static and I put inside it all js files and then我通过添加一个名为 static 的新文件夹来解决此问题,然后将所有 js 文件放入其中,然后
script: [
{ src: './js/jquery-3.4.1.min.js', type: 'text/javascript' },
],
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.