【问题标题】:Vue.js - Prerender pluginVue.js - 预渲染插件
【发布时间】:2017-12-13 14:06:26
【问题描述】:

我想使用这个plugin。预渲染我的一些vue.js 组件。

我的项目结构是Laravel 5.4附带的那个

├── app
├── artisan
├── bootstrap
├── resources
    ├── assets
        js
        app.js
        bootstrap.js
        components
webpackconfig.js

我的组件位于components

我在webpackconfig.js 中添加了这个,以尝试渲染链接到/ 路由的组件。

new PrerenderSpaPlugin(path.join(__dirname, './dist'), [ '/' ]),

问题

生成的文件index.html包含{"statusCode":404,"error":"Not Found"}

问题

我应该怎么做才能预渲染我的组件?

【问题讨论】:

    标签: vue.js prerender


    【解决方案1】:

    按照文档示例进行操作。您使用了错误的路径,请使用 ../dist 而不是 ./dist

    new PrerenderSpaPlugin(
        // Path to compiled app
        path.join(__dirname, '../dist'),
        // List of endpoints you wish to prerender
       [ '/' ]
    )
    

    https://vuejs-templates.github.io/webpack/prerender.html

    【讨论】:

      【解决方案2】:

      您应该为您的index.html 入口点定位正确的路径。
      您当前的目标是 dist 文件夹。

      【讨论】:

        猜你喜欢
        • 2020-06-03
        • 2018-01-24
        • 2016-02-07
        • 1970-01-01
        • 2019-08-07
        • 2017-08-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多