Rollup-plugin-vue: Version 4 onwards breaks pug templating support?

Created on 7 May 2018  Â·  2Comments  Â·  Source: vuejs/rollup-plugin-vue

Expected behavior

Expect successful build when running rollup

Actual behavior

Build fails with message:

src/index.js → dist/vue-mapbox-map.umd.js...
[!] (vue plugin) TypeError: Cannot read property 'trim' of undefined
src/VueMapboxMap.vue
TypeError: Cannot read property 'trim' of undefined
    at baseCompile (/Users/gareth/dev/github/vue-mapbox-map/node_modules/vue-template-compiler/build.js:4267:28)
    at compile (/Users/gareth/dev/github/vue-mapbox-map/node_modules/vue-template-compiler/build.js:4242:22)
    at actuallyCompile (/Users/gareth/dev/github/vue-mapbox-map/node_modules/@vue/component-compiler-utils/dist/compileTemplate.js:57:55)
    at Object.compileTemplate (/Users/gareth/dev/github/vue-mapbox-map/node_modules/@vue/component-compiler-utils/dist/compileTemplate.js:12:16)
    at SFCCompiler.compileTemplate (/Users/gareth/dev/github/vue-mapbox-map/node_modules/@vue/component-compiler/dist/compiler.js:54:73)
    at SFCCompiler.compileToDescriptor (/Users/gareth/dev/github/vue-mapbox-map/node_modules/@vue/component-compiler/dist/compiler.js:34:54)
    at Object._callee$ (/Users/gareth/dev/github/vue-mapbox-map/node_modules/rollup-plugin-vue/dist/rollup-plugin-vue.common.js:89:39)
    at tryCatch (/Users/gareth/dev/github/vue-mapbox-map/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/Users/gareth/dev/github/vue-mapbox-map/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/gareth/dev/github/vue-mapbox-map/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/Users/gareth/dev/github/vue-mapbox-map/node_modules/@babel/runtime/helpers/asyncToGenerator.js:12:30)
    at _next (/Users/gareth/dev/github/vue-mapbox-map/node_modules/@babel/runtime/helpers/asyncToGenerator.js:27:9)
    at /Users/gareth/dev/github/vue-mapbox-map/node_modules/@babel/runtime/helpers/asyncToGenerator.js:34:7
    at new Promise (/Users/gareth/dev/github/vue-mapbox-map/node_modules/core-js/library/modules/es6.promise.js:177:7)
    at Object.<anonymous> (/Users/gareth/dev/github/vue-mapbox-map/node_modules/@babel/runtime/helpers/asyncToGenerator.js:7:12)
    at Object.transform (/Users/gareth/dev/github/vue-mapbox-map/node_modules/rollup-plugin-vue/dist/rollup-plugin-vue.common.js:115:27)

Steps to reproduce the behavior

This seems to be triggered by using pug, so add / remove to trigger / resolve the issue:

<template lang='pug'>
    div(ref='mapboxMapDiv')
</template>

Most helpful comment

I hat the same issue and it took me way too long until I realized the obvious:
You need to have pug as a dependancy installed.

So a simple npm install pug worked for me!

All 2 comments

I hat the same issue and it took me way too long until I realized the obvious:
You need to have pug as a dependancy installed.

So a simple npm install pug worked for me!

The latest version of @vue/component-compiler-utils throws an exception with installation instructions if required preprocessor is not installed, the same error is surfaced here in rollup plugin.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rayrutjes picture rayrutjes  Â·  7Comments

ismail9k picture ismail9k  Â·  7Comments

Infeligo picture Infeligo  Â·  4Comments

iassasin picture iassasin  Â·  6Comments

fjc0k picture fjc0k  Â·  4Comments