Vuepress: @vuepress/plugin-last-updated doesn't work on Build

Created on 15 May 2019  路  3Comments  路  Source: vuejs/vuepress




  • [x] I confirm that this is an issue rather than a question.




Bug report

Steps to reproduce

What is expected?

I am using the last-updated plugin and when I use vuepress dev it works as expected (aka the mention "Last Updated: 5/15/2019, 10:06:31 AM" is at the bottom of the page but when I use vuepress build the lastUpdated line no longer shows up in my pages.

What is actually happening?

The Last Updated date does not show up at all when I am building the site.

package.json

{
  "name": "MyProject",
  "version": "1.0.0",
  "main": "index.js",
  "author": "Me",
  "license": "MIT",
  "scripts": {
    "site:dev": "vuepress dev site",
    "site:build": "vuepress build site"
  },
  "devDependencies": {
    "@vuepress/plugin-back-to-top": "^1.0.0-alpha.48",
    "@vuepress/plugin-last-updated": "^1.0.0-alpha.48",
    "@vuepress/plugin-medium-zoom": "^1.0.0-alpha.48",
    "vuepress": "^1.0.0-alpha.47",
    "vuepress-plugin-reading-time": "^0.1.1"
  },
  "dependencies": {
    "jdenticon": "^2.1.1",
    "tailwindcss": "^0.7.4"
  }
}

config.js

module.exports = {
  title: 'Data Site',
  description: Mysite',
  head: [
    ['link', { rel: 'icon', type: "image/x-icon", href: `/img/dig.png` }]
  ],
  themeConfig: {
    logo: '/img/logo3.png',
    users: users,
    pageSize: 6,
        startPage: 0,
    editLinks: true,
    editLinkText: 'Edit this page on Bitbucket',
    lastUpdated: 'Last Updated',
    repo: 'https://bitbucket.org/myaccount/mysite/',
    docsDir: 'site',
        newestFirst: true,
    nav: [
      { text: 'Home', link: '/' },
      { text: 'Dashboards',
        items: [
          { text: 'FirstPage', link:'/dashboards/first/' },
        ]
      },
      { text: 'Documentation', link: '/docs/' },
      { text: 'Contributors', link: '/contributors/' },
    ],
    sidebar: {
      '/docs/': [
        {
          title: 'Documentation',
          collapsable: false,
          children: [
            '/docs/'
        ]
      },
      {
        title: 'Dashboards',
        collapsable: true,
        children: [
          '/docs/dashboards/'
        ]
      },
      {
        title: 'Pipelines',
        collapsable: true,
        children: [
          '/docs/pipelines/'
        ]
      },
      {
        title: 'Models',
        collapsable: true,
        children: [
          '/docs/models/'
        ]
      },
      {
        title: 'Infrastructure',
        collapsable: true,
        children: [
          '/docs/infrastructure/ECScluster',
          '/docs/infrastructure/ECR'
        ]
      },
      {
        title: 'Other',
        collapsable: true,
        children: [
          '/docs/other/bitbucket',
          '/docs/other/terminal',
          '/docs/other/asana',
        ]
      }
      ]
    },
},
plugins: [
            'vuepress-plugin-reading-time',
            '@vuepress/plugin-back-to-top',
            '@vuepress/plugin-last-updated',
            require('./custom-search/index.js',
            '@vuepress/plugin-medium-zoom')
          ],
postcss: {
    plugins: [
      require("tailwindcss")("./site/.vuepress/tailwind.config.js"),
      require("autoprefixer"),
    ],
  }
}

Other relevant information


  • [x ] My VuePress version is lower and euqal than 1.0.0-alpha.47:

    • VuePress version: ^1.0.0-alpha.47"
    • OS: Mojave 10.14
    • Node.js version: 8.10.0
    • Browser version: Chrome Version 74.0.3729.131 (Official Build) (64-bit)
    • Is this a global or local install? global
    • Which package manager did you use for the install? yarn
    • Does this issue occur when all plugins are disabled? It's an issue with a plugin
  • [ ] My VuePress version is higher than 1.0.0-alpha.47, the following is the output of npx vuepress info in my VuePress project:

Most helpful comment

Solved my issue I had .git in my .dockerignore file which is what last-updated uses to fetch the date. Mistery solved!

All 3 comments

I also can't get the plugin medium-zoom to work...

I am also using docker to deploy my build with the following Dockerfile:

#Stage 1 Build the App
FROM node:8.16 as build-deps
RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y git
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn
COPY . ./
RUN yarn site:build

#Stage 2 Productionalize the app
FROM nginx:alpine

#Copying build file from previous stage
COPY --from=build-deps /usr/src/app/site/.vuepress/dist /usr/share/nginx/html

# Remove default configuration from Nginx
RUN rm /etc/nginx/conf.d/default.conf
# Copy the modified Nginx conf
COPY /srv/nginx.conf /etc/nginx/conf.d/


EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

Not sure if it has an impact on it or not

Solved my issue I had .git in my .dockerignore file which is what last-updated uses to fetch the date. Mistery solved!

Was this page helpful?
0 / 5 - 0 ratings