问答

nuxt 上线后找不到 _nuxt/ 下的js 文件

作者:admin 2021-07-09 我要评论

nuxt上线后static下面的文件需要拿出来才可以访问到, _nuxt/ 下的编译的js找不到。 ### 没有调用后台接口 ### 可以考虑下这些js文件在发布时的路径有没有问题 #...

在说正事之前,我要推荐一个福利:你还在原价购买阿里云、腾讯云、华为云服务器吗?那太亏啦!来这里,新购、升级、续费都打折,能够为您省60%的钱呢!2核4G企业级云服务器低至69元/年,点击进去看看吧>>>)

nuxt上线后static下面的文件需要拿出来才可以访问到,
_nuxt/ 下的编译的js找不到。
image.png

###

没有调用后台接口

###

可以考虑下这些js文件在发布时的路径有没有问题

###

请问现在这个问题解决了吗?我也遇到了,不知道如何解决

###

请问怎么解决的 我也遇到了

###

要设置资源访问路径
config/index.js
`build: {

// Template for index.html

index: path.resolve(__dirname, '../dist/index.html'),

// Paths

assetsRoot: path.resolve(__dirname, '../dist'),

assetsSubDirectory: 'static',

// 资源引用的路径

assetsPublicPath: './',

/**

* Source Maps

*/

productionSourceMap: true,

// https://webpack.js.org/config...

devtool: '#source-map',

// Gzip off by default as many popular static hosts such as

// Surge or Netlify already gzip all static assets for you.

// Before setting to `true`, make sure to:

// npm install --save-dev compression-webpack-plugin

productionGzip: false,

productionGzipExtensions: ['js', 'css'],

// Run the build command with an extra argument to

// View the bundle analyzer report after build finishes:

// `npm run build --report`

// Set to `true` or `false` to always turn it on or off

bundleAnalyzerReport: process.env.npm_config_report

}`

版权声明:本文转载自网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本站转载出于传播更多优秀技术知识之目的,如有侵权请联系QQ/微信:153890879删除

相关文章
  • elementUI表单Object.assign处理后无法

    elementUI表单Object.assign处理后无法

  • nacos作为配置中,有时可以加载到配置

    nacos作为配置中,有时可以加载到配置

  • font-spider压缩字体后,文件大小没有

    font-spider压缩字体后,文件大小没有

  • Vue SSR babel node_modules中的一个包

    Vue SSR babel node_modules中的一个包

腾讯云代理商
海外云服务器