nuxt上线后static下面的文件需要拿出来才可以访问到,
_nuxt/ 下的编译的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
}`
8 回答4.8k 阅读✓ 已解决
6 回答3.5k 阅读✓ 已解决
6 回答2.4k 阅读
5 回答6.4k 阅读✓ 已解决
3 回答2.5k 阅读✓ 已解决
3 回答2.1k 阅读✓ 已解决
3 回答2.6k 阅读✓ 已解决
没有调用后台接口