easy-team / egg-vue-webpack-boilerplate

Egg Vue Server Side Render (SSR) / Client Side Render (CSR)
https://easyjs.cn/egg-vue
MIT License
1.36k stars 248 forks source link

server-side-render-resource 插入js到html报错,manifest.deps未undefined #57

Closed GSBL closed 6 years ago

GSBL commented 6 years ago
mac os , 
"egg": "^2.1.0",
 25     "egg-cors": "^2.0.0",
 26     "egg-logger": "^1.5.0",
 27     "egg-passport": "^2.0.1",
 28     "egg-session": "^3.1.0",
 29     "egg-validate": "^1.0.0",
 30     "egg-view-vue-ssr": "^3.0.5"
"server-side-render-resource": "^1.0.3",
 41     "vue": "^2.5.0",
 42     "vue-hot-reload-api": "^2.1.0",
 43     "vue-router": "^3.0.1",
 44     "vue-server-renderer": "^2.5.3",
 45     "vuex": "^3.0.1",
 46     "vuex-router-sync": "^5.0.0"

server-side-render-resource 插入js, manifest.deps = undefined image manifest.json中也没deps属性:

{
  "app/app.js": "js/app/app.js",
  "common.js": "js/common.js",
  "font/Simple-Line-Icons.eot?": "font/Simple-Line-Icons.eot",
  "font/Simple-Line-Icons.ttf": "font/Simple-Line-Icons.ttf",
  "font/Simple-Line-Icons.woff": "font/Simple-Line-Icons.woff",
  "font/Simple-Line-Icons.woff2": "font/Simple-Line-Icons.woff2",
  "font/fontawesome-webfont.eot?": "font/fontawesome-webfont.eot",
  "font/fontawesome-webfont.ttf": "font/fontawesome-webfont.ttf",
  "font/fontawesome-webfont.woff": "font/fontawesome-webfont.woff",
  "font/fontawesome-webfont.woff2": "font/fontawesome-webfont.woff2",
  "font/glyphicons-halflings-regular.eot": "font/glyphicons-halflings-regular.eot",
  "font/glyphicons-halflings-regular.ttf": "font/glyphicons-halflings-regular.ttf",
  "font/glyphicons-halflings-regular.woff": "font/glyphicons-halflings-regular.woff",
  "font/glyphicons-halflings-regular.woff2": "font/glyphicons-halflings-regular.woff2",
  "font/linea-arrows-10.eot?": "font/linea-arrows-10.eot",
  "font/linea-arrows-10.ttf": "font/linea-arrows-10.ttf",
  "font/linea-arrows-10.woff": "font/linea-arrows-10.woff",
  "font/linea-basic-10.eot?": "font/linea-basic-10.eot",
  "font/linea-basic-10.ttf": "font/linea-basic-10.ttf",
  "font/linea-basic-10.woff": "font/linea-basic-10.woff",
  "font/linea-basic-elaboration-10.eot?": "font/linea-basic-elaboration-10.eot",
  "font/linea-basic-elaboration-10.ttf": "font/linea-basic-elaboration-10.ttf",
  "font/linea-basic-elaboration-10.woff": "font/linea-basic-elaboration-10.woff",
  "font/linea-ecommerce-10.eot?": "font/linea-ecommerce-10.eot",
  "font/linea-ecommerce-10.ttf": "font/linea-ecommerce-10.ttf",
  "font/linea-ecommerce-10.woff": "font/linea-ecommerce-10.woff",
  "font/linea-music-10.eot?": "font/linea-music-10.eot",
  "font/linea-music-10.ttf": "font/linea-music-10.ttf",
  "font/linea-music-10.woff": "font/linea-music-10.woff",
  "font/linea-software-10.eot?": "font/linea-software-10.eot",
  "font/linea-software-10.ttf": "font/linea-software-10.ttf",
  "font/linea-software-10.woff": "font/linea-software-10.woff",
  "font/linea-weather-10.eot?": "font/linea-weather-10.eot",
  "font/linea-weather-10.ttf": "font/linea-weather-10.ttf",
  "font/linea-weather-10.woff": "font/linea-weather-10.woff",
  "font/materialdesignicons-webfont.eot": "font/materialdesignicons-webfont.eot",
  "font/materialdesignicons-webfont.ttf": "font/materialdesignicons-webfont.ttf",
  "font/materialdesignicons-webfont.woff": "font/materialdesignicons-webfont.woff",
  "font/materialdesignicons-webfont.woff2": "font/materialdesignicons-webfont.woff2",
  "font/themify.eot?": "font/themify.eot",
  "font/themify.ttf": "font/themify.ttf",
  "font/themify.woff": "font/themify.woff",
  "font/weathericons-regular-webfont.eot?": "font/weathericons-regular-webfont.eot",
  "font/weathericons-regular-webfont.ttf": "font/weathericons-regular-webfont.ttf",
  "font/weathericons-regular-webfont.woff": "font/weathericons-regular-webfont.woff",
  "font/weathericons-regular-webfont.woff2": "font/weathericons-regular-webfont.woff2",
  "img/Simple-Line-Icons.svg": "img/Simple-Line-Icons.svg",
  "img/admin-logo-dark.png": "img/admin-logo-dark.png",
  "img/admin-logo.png": "img/admin-logo.png",
  "img/admin-text-dark.png": "img/admin-text-dark.png",
  "img/admin-text.png": "img/admin-text.png",
  "img/fontawesome-webfont.svg": "img/fontawesome-webfont.svg",
  "img/glyphicons-halflings-regular.svg": "img/glyphicons-halflings-regular.svg",
  "img/linea-arrows-10.svg": "img/linea-arrows-10.svg",
  "img/linea-basic-10.svg": "img/linea-basic-10.svg",
  "img/linea-basic-elaboration-10.svg": "img/linea-basic-elaboration-10.svg",
  "img/linea-ecommerce-10.svg": "img/linea-ecommerce-10.svg",
  "img/linea-music-10.svg": "img/linea-music-10.svg",
  "img/linea-software-10.svg": "img/linea-software-10.svg",
  "img/linea-weather-10.svg": "img/linea-weather-10.svg",
  "img/login-register.jpg": "img/login-register.jpg",
  "img/materialdesignicons-webfont.svg": "img/materialdesignicons-webfont.svg",
  "img/themify.svg": "img/themify.svg",
  "img/varun.jpg": "img/varun.jpg",
  "img/weathericons-regular-webfont.svg": "img/weathericons-regular-webfont.svg",
  "login/login.js": "js/login/login.js",
  "register/register.js": "js/register/register.js"
}
hubcarl commented 6 years ago

这个项目你是自己搭建还是之前的版本? 有几个插件要装一下新版本

dependencies:{ "egg-view-vue-ssr": "^3.0.5", }

devDependencies:{ "easywebpack-cli": "^3.6.0", "easywebpack-vue": "^3.6.0", "egg-webpack": "^3.2.8", "egg-webpack-vue": "^2.0.0", "webpack-manifest-resource-plugin": "^2.0.2" }

具体依赖可以对比一下骨架项目

版本说明:http://hubcarl.github.io/easywebpack/webpack/version/

GSBL commented 6 years ago

npm update 之后也是报错

2018-02-02 10:58:25,399 DEBUG 11776 Resource#this.config.injectRes []
2018-02-02 10:58:25,401 ERROR 11776 [-/172.18.18.48/-/44ms GET /] nodejs.TypeError: Cannot read property 'app/app.js' of undefined
    at Resource.inject (/Users/huangguanghui/Desktop/repos/egg/smart-analytics/node_modules/server-side-render-resource/lib/resource.js:124:36)
    at renderString.then.html (/Users/huangguanghui/Desktop/repos/egg/smart-analytics/node_modules/egg-view-vue-ssr/lib/engine.js:99:28)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
 {
  "name": "smart-analytics",
  "version": "3.6.5",
  "description": "smart-analytics",
  "scripts": {
    "build": "cross-env easywebpack build prod",
    "build:dev": "cross-env easywebpack build dev",
    "build:test": "cross-env easywebpack build test",
    "build:prod": "cross-env easywebpack build prod",
    "dll": "cross-env easywebpack build dev -f webpack.dll.js",
    "start": "node index.js",
    "start:test": "cross-env EGG_SERVER_ENV=test node index.js",
    "start:prod": "cross-env EGG_SERVER_ENV=prod NODE_ENV=production npm start",
    "kill": "pkill --signal SIGINT egg-vue-webpack-boilerplate",
    "kill-mac": "kill -9 $(lsof -i:7001 |grep 'node'|awk '{print $2}')",
    "kill-win": "taskkill -PID $(netstat -ano | findstr 7001|awk '{print $5}') -F",
    "restart": "npm run kill-port && npm run start",
    "lint": "eslint .",
    "fix": "eslint --fix ."
  },
  "dependencies": {
    "axios": "^0.17.1",
    "connect-ensure-login": "^0.1.1",
    "egg": "^2.1.0",
    "egg-cors": "^2.0.0",
    "egg-logger": "^1.5.0",
    "egg-passport": "^2.0.1",
    "egg-session": "^3.1.0",
    "egg-validate": "^1.0.0",
    "egg-view-vue-ssr": "^3.0.5",
    "element-ui": "^2.1.0",
    "extend": "~3.0.0",
    "js-cookie": "^2.2.0",
    "koa-ensure-login": "^0.1.0",
    "lodash": "^4.17.4",
    "mint-ui": "^2.2.9",
    "mockjs": "^1.0.1-beta3",
    "moment": "^2.17.1",
    "passport-local": "^1.0.0",
    "server-side-render-resource": "^1.0.3",
    "vue": "^2.5.0",
    "vue-hot-reload-api": "^2.1.0",
    "vue-router": "^3.0.1",
    "vue-server-renderer": "^2.5.3",
    "vuex": "^3.0.1",
    "vuex-router-sync": "^5.0.0"
  },
  "devDependencies": {
    "animate.css": "^3.5.2",
    "autod-egg": "^1.0.0",
    "autoprefixer": "^7.1.4",
    "babel-core": "^6.26.0",
    "babel-eslint": "^8.1.2",
    "babel-loader": "^7.1.2",
    "babel-plugin-add-module-exports": "^0.2.1",
    "babel-plugin-syntax-dynamic-import": "^6.18.0",
    "babel-plugin-transform-object-assign": "^6.22.0",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-plugin-transform-runtime": "^6.15.0",
    "babel-preset-env": "^1.6.0",
    "bootstrap": "^3.3.7",
    "cross-env": "^5.0.0",
    "directory-named-webpack-plugin": "^2.2.3",
    "easywebpack-cli": "^3.6.0",
    "easywebpack-vue": "^3.6.0",
    "egg-logview": "^1.0.0",
    "egg-mysql": "^3.0.0",
    "egg-passport-local": "^1.1.0",
    "egg-view-nunjucks": "^2.1.4",
    "egg-webpack": "^3.2.8",
    "egg-webpack-vue": "^2.0.0",
    "eslint": "^4.3.0",
    "eslint-config-egg": "^5.0.0",
    "eslint-loader": "^1.9.0",
    "eslint-plugin-vue": "^2.0.1",
    "imagemin-webpack-plugin": "^1.5.2",
    "install": "^0.10.2",
    "ip": "^1.1.5",
    "jquery": "^3.3.1",
    "less": "^2.7.3",
    "less-loader": "^4.0.5",
    "node-sass": "^4.5.3",
    "postcss-loader": "^2.1.0",
    "progress-bar-webpack-plugin": "^1.10.0",
    "sass-loader": "^6.0.6",
    "sha1": "^1.1.1",
    "uglifyjs-webpack-plugin": "^1.1.8",
    "vconsole": "^3.0.0",
    "vue-echarts": "^3.0.1",
    "vue-template-compiler": "^2.4.4",
    "webpack-manifest-plugin": "^1.3.2",
    "webpack-manifest-resource-plugin": "^2.0.2"
  },
  "engines": {
    "node": ">=6.0.0"
  },
  "ci": {
    "version": "6, 7, 8"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/hubcarl/egg-vue-webpack-boilerplate.git"
  },
  "author": "hubcarl@126.com",
  "license": "MIT",
  "homepage": "https://github.com/hubcarl/egg-vue-webpack-boilerplate"
}
hubcarl commented 6 years ago

@GSBL 最好删除 node_modules, 重新装一下依赖看看, 如果还出错,参考一下骨架项目依赖,或者 提供一个 github demo 我试试