question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot call .tap() on a plugin that has not yet been defined. Call plugin('html').use(<Plugin>) first.

See original GitHub issue

Describe the bug After following instructions in README.md, running npm run build gives error: Cannot call .tap() on a plugin that has not yet been defined. Call plugin('html').use(<Plugin>) first.

To Reproduce Steps to reproduce the behavior:

  1. vue add prerender-spa
  2. Enter default answers
  3. Run npm run build
  4. See error

Expected behavior Project builds succesfully 🎉

Screenshots

-> % vue add prerender-spa

📦  Installing vue-cli-plugin-prerender-spa...


added 20 packages, removed 1 package, and audited 1376 packages in 46s

73 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
✔  Successfully installed plugin: vue-cli-plugin-prerender-spa

? Which routes to pre-render? (separate with comma) (only with Vue Router history mode) /
? Use a render event to trigger the snapshot? Yes
? Use a headless browser to render the application? (recommended) Yes
? Only use prerendering for production builds? (recommended) Yes

🚀  Invoking generator for vue-cli-plugin-prerender-spa...
📦  Installing additional dependencies...


up to date, audited 1376 packages in 2s

73 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
⚓  Running completion hooks...

✔  Successfully invoked generator for plugin: vue-cli-plugin-prerender-spa
user@iMac [11:45:57] [~/path/portfolio] [master *]
-> % npm run build

> paper_free_resume@0.1.0 build
> vue-cli-service build


✔  Building for production...
 ERROR  Error: Cannot call .tap() on a plugin that has not yet been defined. Call plugin('html').use(<Plugin>) first.
Error: Cannot call .tap() on a plugin that has not yet been defined. Call plugin('html').use(<Plugin>) first.
    at Object.tap (/path/portfolio/node_modules/webpack-chain/src/Plugin.js:26:15)
    at /path/portfolio/node_modules/vue-cli-plugin-prerender-spa/index.js:55:29
    at /path/portfolio/node_modules/@vue/cli-service/lib/Service.js:236:40
    at Array.forEach (<anonymous>)
    at Service.resolveChainableWebpackConfig (/path/portfolio/node_modules/@vue/cli-service/lib/Service.js:236:26)
    at PluginAPI.resolveChainableWebpackConfig (/path/portfolio/node_modules/@vue/cli-service/lib/PluginAPI.js:145:25)
    at module.exports (/path/portfolio/node_modules/@vue/cli-service/lib/commands/build/resolveAppConfig.js:9:22)
    at build (/path/portfolio/node_modules/@vue/cli-service/lib/commands/build/index.js:147:50)
    at /path/portfolio/node_modules/@vue/cli-service/lib/commands/build/index.js:89:13
    at Service.run (/path/portfolio/node_modules/@vue/cli-service/lib/Service.js:230:12)
    at Object.<anonymous> (/path/portfolio/node_modules/@vue/cli-service/bin/vue-cli-service.js:36:9)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)

Additional context

Package version:

"prerender-spa-plugin": "^3.2.1",
"vue-cli-plugin-prerender-spa": "~1.1.6",

Vue version:

"vue": "^2.6.11",

Vue CLI version:

-> % vue --version
@vue/cli 4.5.11

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
ricky11commented, Apr 26, 2021

this repo needs love… vue pre-rendering is lacking so much support.

0reactions
y-a-avacommented, Feb 7, 2022

try this:

const html = require(‘html-webpack-plugin’) chainWebpack: config => { config .plugin(‘html’) .use(html) // when this doesnt exist it fails .tap(args => { return args })

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot call .tap() on a plugin that has not yet been defined ...
Error : Cannot call .tap() on a plugin that has not yet been defined. Call plugin( 'html' ).use(<Plugin>) first. 解决方法:.
Read more >
can't add plugin to vue.config.js with configureWebpack
Because Vue already includes the DefinePlugin , you need to modify it using Webpack's chain API instead of attempting to add a new...
Read more >
Error: Cannot call .tap() on a plugin that has not yet ... - 学习猿地
Error : Cannot call .tap() on a plugin that has not yet been defined. Call plugin('html').use(<Plugin>) first.
Read more >
Error: Cannot call .tap() on a plugin that has not yet ... - 博客园
Error : Cannot call .tap() on a plugin that has not yet been defined. Call plugin('html').use(<Plugin>) first.
Read more >
Vue upgrade 8.37->8.38 webpack issues
Error : Cannot call .tap() on a plugin that has not yet been defined. Call plugin('prefetch').use() first. at Object.tap (/Users/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found