canvg optionalDependency is installed on npm install
See original GitHub issueBecause it’s declared as dependency in package.json, canvg is installed and loads core-js from babel.
My project uses angular and angular-cli throws warnings about those, because angular-cli@>=v8.0.0 already handles core-js imports automatically.
WARNING in /Users/.../Desktop/Projects/.../.../node_modules/canvg/lib/index.es.js depends on '@babel/runtime-corejs3/regenerator'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
I’ve already opened an issue in canvg repo, but the problem is in fact in jspdf repo. https://github.com/canvg/canvg/issues/1253
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5
Top Results From Across the Web
canvg - npm
Start using canvg in your project by running `npm i canvg`. There are 193 other projects in the npm registry using canvg.
Read more >A brand new website interface for an even better experience!
canvg optionalDependency is installed on npm install.
Read more >npm install cannot find package.json from dependencies of ...
Installed n and tried different versions of nodejs/npm. I run the npm command inside the virtual machine Homestead which runs : Homestead 9.4.0 ......
Read more >What are Optional Dependencies and when should we use them
Does npm install optional dependencies: The npm will automatically ... Installing Colors package as an optional dependency: As an example, ...
Read more >What's the difference between `dependencies ... - Sentry
You can add dependencies to the optionalDependencies object by manually modifying the package.json file. Further Reading. Find the Installed Version of an npm...
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
For me I include this lines to my
angular.json
file :It work for me and remove warnings
@pete-mcwilliams what kind of dependency it is does AKAIK not matter for the build tools. They will create a chunk for the optional dependencies no matter what. However, since the optional dependencies are imported with dynamic imports, they will end up in separate chunks. These chunks will only be loaded when the respective code paths are executed.
Currently, the optional dependencies are declared as “optionalDependencies”. Making them “peerDependencies” will not really make a difference with npm 7+ (See e.g. https://github.blog/2021-02-02-npm-7-is-now-generally-available/#peer-dependencies), as they will get installed automatically, too.