vue-cli-plugin-prerender-spa icon indicating copy to clipboard operation
vue-cli-plugin-prerender-spa copied to clipboard

Unexpected token at config

Open JFGHT opened this issue 5 years ago • 1 comments

Describe the bug It simply doesn't work after answering the questions.

Error: Line 14: Unexpected token ...
    at ErrorHandler.constructError (/home/user/.config/yarn/global/node_modules/esprima/dist/esprima.js:5012:22)
    at ErrorHandler.createError (/home/user/.config/yarn/global/node_modules/esprima/dist/esprima.js:5028:27)
    at Parser.unexpectedTokenError (/home/user/.config/yarn/global/node_modules/esprima/dist/esprima.js:1985:39)
    at Parser.throwUnexpectedToken (/home/user/.config/yarn/global/node_modules/esprima/dist/esprima.js:1995:21)
    at Parser.parseObjectPropertyKey (/home/user/.config/yarn/global/node_modules/esprima/dist/esprima.js:2499:33)
    at Parser.parseObjectProperty (/home/user/.config/yarn/global/node_modules/esprima/dist/esprima.js:2534:25)
    at Parser.parseObjectInitializer (/home/user/.config/yarn/global/node_modules/esprima/dist/esprima.js:2602:35)
    at Parser.inheritCoverGrammar (/home/user/.config/yarn/global/node_modules/esprima/dist/esprima.js:2285:37)
    at Parser.parsePrimaryExpression (/home/user/.config/yarn/global/node_modules/esprima/dist/esprima.js:2354:38)
    at Parser.inheritCoverGrammar (/home/user/.config/yarn/global/node_modules/esprima/dist/esprima.js:2285:37)

To Reproduce Steps to reproduce the behavior:

  1. vue add prerender-spa
  2. Answer questions
  3. See error

Additional context Vue version: 2.6.10 Vue CLI version: 3.9.3 OS: Ubuntu 19.04 Using typescript.

JFGHT avatar Jul 30 '19 14:07 JFGHT

Same problem here using Windows 10 and TypeScript. Someone has a workaround, plz?

UPDATE: By setting custom configuration options in vue.config.js like explained here the plugin actually works, exept it generates an app.html file (from the main App component, I beleve) which does not include prerendered <meta> tags that are correctly injected into index.html. Maybe this could be avoided in vue.config.js..? Also, I'm missing .prerender-spa.json in the root directory of the project (which maybe wasn't generated because of this issue) and I have no idea what registry: undefined is used for.

My current setup:

pluginOptions: {
  lintStyleOnBuild: true,
  stylelint: {},

  prerenderSpa: {
    registry: undefined,
    renderRoutes: [
      '/',
      '/about'
    ],
    useRenderEvent: false,
    onlyProduction: true,

    headless: true,
    customRendererConfig: {
      args: ['--auto-open-devtools-for-tabs']
    }
  }
},

UstymUkhman avatar Sep 06 '19 13:09 UstymUkhman