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.

Dynamic import in pdf.vue

See original GitHub issue

When building a Webpack bundle, then babel-loader complains about vue-pdf dist file’s dynamic import() token:

build	02-Feb-2018 13:33:20	ERROR in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-pdf/src/pdf.vue
build	02-Feb-2018 13:33:20	Module build failed: SyntaxError: Unexpected token (186:10)
build	02-Feb-2018 13:33:20	
build	02-Feb-2018 13:33:20	  184 | 		this.fetch = function(query) {
build	02-Feb-2018 13:33:20	  185 | 
build	02-Feb-2018 13:33:20	> 186 | 			return import('raw-loader!pdfjs-dist/cmaps/'+query.name+'.bcmap' /* webpackChunkName: "noprefetch-[request]" */)
build	02-Feb-2018 13:33:20	      | 			       ^
build	02-Feb-2018 13:33:20	  187 | 			.then(function(bcmap) {
build	02-Feb-2018 13:33:20	  188 | 
build	02-Feb-2018 13:33:20	  189 | 				return {
build	02-Feb-2018 13:33:20	
build	02-Feb-2018 13:33:20	 @ ./node_modules/vue-pdf/src/pdf.vue 7:2-87

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
andreasvirkuscommented, Feb 7, 2018

Yep, issue seems to be resolved in the newer versions, thanks! 🎉

0reactions
FranckFreiburgercommented, Feb 2, 2018

@babel/plugin-syntax-dynamic-import is for babel 7(beta), use previous one instead

Read more comments on GitHub >

github_iconTop Results From Across the Web

PDF Viewer / How To / Load the PDF documents dynamically
Load the PDF documents dynamically in Vue PDF Viewer component ... The PDF Viewer library allows you to switch or load PDF documents...
Read more >
Rendering PDF pages with PDF.js and Vue - rossta.net
Here's a basic ES6 example of dynamically loading PDF.js to render an entire PDF document (without Vue): import range from 'lodash/range' ...
Read more >
jsPDF Vue js Generating Dynamic PDF from Form - YouTube
jsPDF Vue js Generating Dynamic PDF from FormIn this tutorial I have shown how to generate a dynamic pdf from form using jspdf...
Read more >
[Solved]-Vue CLI dynamic import from project module-Vue.js
Yes, using dynamic imports: To dynamically import a module, the import keyword may be called as a function. When used this way, it...
Read more >
Vue: use a custom libary (pdf.js) in a component
<script> import { PDFJS } from '@/assets/vendor/pdfjs/pdf.js' export ... for your vendor scripts, better use webpacks dynamic import feature ...
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