我正在尝试为我的nuxtjs应用程序生成一个静态网站,然后将其上传到s3存储桶中进行投放。
我运行了npm run generate
,它生成了dist
文件夹。
我将dist
文件夹复制到s3存储桶s3.exampleaws.com/webapp/latest
现在主index.html
文件应位于此处s3.exampleaws.com/webapp/latest/index.html
当我访问该页面时,什么都看不到,并且在控制台上,出现以下错误:
4 GET file:///_nuxt/f69388b45d6b2e9cc542.js net :: ERR_FILE_NOT_FOUND
即使我在浏览器中打开index.html
文件夹中的dist
文件,它仍然显示相同的错误。
有什么方法可以在浏览器上显示该网站?
我的nuxt.config.js
文件如下:
export default {
mode: 'spa',
/*
** Headers of the page
*/
head: {
title: process.env.npm_package_name || '',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Global CSS
*/
css: [
'~/assets/css/tailwind.css',
'~/assets/css/all.css'
],
/*
** Plugins to load before mounting the App
*/
plugins: [
],
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
'@nuxtjs/pwa',
'@nuxtjs/proxy',
'@nuxtjs/toast'
],
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
axios: {
},
/*
** Build configuration
*/
build: {
postcss: {
plugins: {
tailwindcss: './tailwind.config.js'
}
},
/*
** You can extend webpack config here
*/
extend(config, ctx) {
config.output.globalObject = 'this'
}
}
}