Vue.js 2.0 vuex vue-router 实现复杂项目的 SSR

从官方例子里fork出来

https://github.com/bigzhu/vue-hackernews-2.0

不支持vue后缀

修改 build 文件

extensions: ['.js', '.vue'] 加进去

https://github.com/bigzhu/vue-hackernews-2.0/commit/eb5e703dc41ad2eb8170044d4b260192376caaa8

不支持css

修改 build 文件

把 loader 加进去

https://github.com/bigzhu/vue-hackernews-2.0/commit/eb5e703dc41ad2eb8170044d4b260192376caaa8

fetch 的问题

var fetch
if (global.window) {
  fetch = window.fetch
} else {
  fetch = require('node-fetch')
}

无法import 外部 css

Error: Cannot find module "../assets/mobile.css"

还没解决

报错

../vue2_base/~/encoding/lib/iconv-loader.js
9:12 Critical dependency: the request of a dependency is an expression
CriticalDependencyWarning: Critical dependency: the request of a dependency is an expression
    at CommonJsRequireContextDependency.getWarnings (/Users/bigzhu/vue-hackernews-2.0/node_modules/webpack/lib/dependencies/CommonJsRequireContextDependency.js:22:4)
    at /Users/bigzhu/vue-hackernews-2.0/node_modules/webpack/lib/Compilation.js:646:21
    at Array.forEach (native)
    at /Users/bigzhu/vue-hackernews-2.0/node_modules/webpack/lib/Compilation.js:645:22
    at Array.forEach (native)
    at Compilation.reportDependencyWarnings (/Users/bigzhu/vue-hackernews-2.0/node_modules/webpack/lib/Compilation.js:644:9)
    at Compilation.<anonymous> (/Users/bigzhu/vue-hackernews-2.0/node_modules/webpack/lib/Compilation.js:505:8)
    at Array.forEach (native)
    at Compilation.finish (/Users/bigzhu/vue-hackernews-2.0/node_modules/webpack/lib/Compilation.js:504:15)
    at /Users/bigzhu/vue-hackernews-2.0/node_modules/webpack/lib/Compiler.js:471:16
    at /Users/bigzhu/vue-hackernews-2.0/node_modules/tapable/lib/Tapable.js:189:11
    at Compilation.<anonymous> (/Users/bigzhu/vue-hackernews-2.0/node_modules/webpack/lib/Compilation.js:452:10)
    at /Users/bigzhu/vue-hackernews-2.0/node_modules/webpack/lib/Compilation.js:423:12
    at /Users/bigzhu/vue-hackernews-2.0/node_modules/webpack/lib/Compilation.js:335:10
    at /Users/bigzhu/vue-hackernews-2.0/node_modules/webpack/node_modules/async/dist/async.js:356:16
    at iteratorCallback (/Users/bigzhu/vue-hackernews-2.0/node_modules/webpack/node_modules/async/dist/async.js:936:13)