首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Vue cli构建显示空白页- Apache服务器

Vue cli构建显示空白页- Apache服务器
EN

Stack Overflow用户
提问于 2021-12-10 02:41:32
回答 1查看 219关注 0票数 1

我对vue cli有点意见。当我运行npm,运行发球,一切顺利。当我进入dev模式时,npm运行build,构建过程完成。我有一页空白。

错误消息是"Uncaught :意外令牌'<'“

下面是我的设置: pacakge.json

代码语言:javascript
复制
{
  "name": "gold",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "test:unit": "vue-cli-service test:unit",
    "lint": "vue-cli-service lint",
    "build-dev": "vue-cli-service build --mode production-dev",
    "build-production": "vue-cli-service build"
  },
  "dependencies": {
    "axios": "^0.21.1",
    "babel-polyfill": "^6.26.0",
    "camelize2": "^1.0.0",
    "core-js": "^3.6.5",
    "element-ui": "^2.15.5",
    "vue": "^2.6.14",
    "vue-carousel": "^0.18.0",
    "vue-router": "^3.2.0",
    "vuex": "^3.4.0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-unit-jest": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/eslint-config-standard": "^5.1.2",
    "@vue/test-utils": "^1.0.3",
    "babel-eslint": "^10.1.0",
    "babel-plugin-component": "^1.1.1",
    "eslint": "^6.8.0",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.0",
    "eslint-plugin-vue": "^6.2.2",
    "sass": "^1.26.5",
    "sass-loader": "^8.0.2",
    "vue-template-compiler": "^2.6.14",
    "webpack-bundle-analyzer": "^3.9.0"
  }
}

vue.config.js

代码语言:javascript
复制
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
//   .BundleAnalyzerPlugin

module.exports = {
  // options...
  // configureWebpack: {
  //   plugins: [new BundleAnalyzerPlugin()]
  // },
  // configureWebpack: {
  //   optimization: {
  //     runtimeChunk: 'single',
  //     splitChunks: {
  //       chunks: 'all',
  //       maxInitialRequests: Infinity,
  //       minSize: 0,
  //       cacheGroups: {
  //         vendor: {
  //           test: /[\\/]node_modules[\\/]/,
  //           name(module) {
  //             // get the name. E.g. node_modules/packageName/not/this/part.js
  //             // or node_modules/packageName
  //             const packageName = module.context.match(
  //               /[\\/]node_modules[\\/](.*?)([\\/]|$)/
  //             )[1]

  //             // npm package names are URL-safe, but some servers don't like @ symbols
  //             return `npm.${packageName.replace('@', '')}`
  //           }
  //         }
  //       }
  //     }
  //   }
  // },
  devServer: {
    port: 8989
  },
  transpileDependencies: ['camelcase']
}

对不起,如果我不能显示任何进一步的代码,谢谢。

EN

回答 1

Stack Overflow用户

发布于 2021-12-10 03:01:55

看来你找不到正确的道路了。例如,尝试使用相对路径

代码语言:javascript
复制
module.exports = {
  productionSourceMap: false,  
  outputDir: '../dist',
  assetsDir: 'static',
  indexPath: 'src/index.html'
};
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70299139

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档