ES6 import doesn't work in versions 1.5.1 and 1.5.2
See original GitHub issueI’m trying to import jspdf
into my Vuejs application. But looks like it imports function RGBColor
instead of the the module.
Are you using the latest version of jsPDF? Yes
Have you tried using jspdf.debug.js? Yes
Steps to reproduce
import jsPDF from 'jspdf/dist/jspdf.debug';
console.log(jsPDF);
or
import * as jsPDF from 'jspdf/dist/jspdf.debug';
console.log(jsPDF);
What I saw Output in versions 1.5.1 and 1.5.2:
RGBColor()
length: 1
name: "RGBColor"
prototype: Object { … }
__proto__: function ()
What I expected Output in 1.4.1:
jsPDF()
API: Object { events: (13) […], addField: addField(), addButton: addButton(), … }
length: 4
name: "jsPDF"
prototype: Object { … }
saveAs: function saveAs()
version: "0.0.0"
__proto__: function ()
Is something wrong with my setup?
My env:
$ vue info
Environment Info:
System:
OS: Windows 7
CPU: (4) x64 Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
Binaries:
Node: 8.11.3 - C:\Programs\Devel\node\node.EXE
Yarn: Not Found
npm: 6.5.0 - C:\Programs\Devel\node\npm.CMD
npmPackages:
@vue/babel-preset-app: 3.2.0
@vue/cli-overlay: 3.2.0
@vue/cli-plugin-babel: ^3.2.0 => 3.2.0
@vue/cli-plugin-eslint: ^3.2.0 => 3.2.1
@vue/cli-service: ^3.2.0 => 3.2.0
@vue/cli-shared-utils: 3.2.0
@vue/component-compiler-utils: 2.3.1
@vue/eslint-config-airbnb: ^4.0.0 => 4.0.0
@vue/preload-webpack-plugin: 1.1.0
@vue/web-component-wrapper: 1.2.0
babel-helper-vue-jsx-merge-props: 2.0.3
babel-plugin-transform-vue-jsx: 4.0.1
eslint-plugin-vue: ^5.0.0-0 => 5.0.0
vue: ^2.5.17 => 2.5.21
vue-eslint-parser: 2.0.3
vue-hot-reload-api: 2.3.1
vue-loader: 15.4.2
vue-style-loader: 4.1.2
vue-template-compiler: ^2.5.17 => 2.5.21
vue-template-es2015-compiler: 1.6.0
npmGlobalPackages:
@vue/cli: Not Found
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:69
Top Results From Across the Web
ES6 import doesn't work in versions 1.5.1 and 1.5.2 #2176
I'm trying to import jspdf into my Vuejs application. But looks like it imports function RGBColor instead of the the module.
Read more >SyntaxError: Cannot use import statement outside a module
Verify that you have the latest version of Node.js installed (or, at least 13.2.0+). ... Some newer ES6 modules works only with import....
Read more >Using ECMAScript 6 (ES6/ES2015) with AngularJS 1.x
I stumbled over the first real problems, when I was trying to use ES6 modules, and using the import statement to import them...
Read more >JavaScript Modules with Import/Export Syntax (ES6) - YouTube
In this video I'll be showing you how to use native JavaScript Modules with the import and export syntax in JavaScript - this...
Read more >Documentation - Modules - TypeScript
If you have a file that doesn't currently have any import s or export s, but you want to be treated ... This...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
yeah, this is the same error. I am working on it.
jspdf.debug.js?6964:22371
What does this mean? line 6964 at character 22371? jspdf.debug.js doesnt have this position.
I checked right now jspdf.debug.js. charAt is used 34 times. The only case where a charAt exception could still happen, would mean, that you supplied invalid data for a custom font.
I made very small changes. Check the following dist-files.
Removing dist zip
But lets be honest: If this doesnt fix your issue, the problem is on your side and not on my side. Probably you use a framework which builds the code. So just changing the files in the modules folder is not enough. you have to recompile your source after changing the libs. If you can’t change the jspdf lib, then wait till we release the next version.