hello guys,
i need some advice, hot to add to plugin development libraries: html2cavas, pdfmake:
i define:
const app = uiModules.get('app/logger', );
then i create controller
app.controller('loggerController', function ($scope, kbnUrl, $route, $routeParams, $window, $interval, $http, $document, $timeout, $location) {
...
$scope.exportData = function() { html2canvas(document.getElementById('exportthis'), { onrendered: function (canvas) { var data = canvas.toDataURL(); var docDefinition = { content: [{ image: data, width: 500, }] }; pdfMake.createPdf(docDefinition).download("report.pdf"); } }); } }
with npm install i install pdfmake and html2canvas
and try to impport this with 2 way:
require('pdfmake')
require('html2canvas'
or try
import from ('pdfmake')
import from ('html2canvas')
after i got exception when i run npm start:
optmzr log [11:44:30.393] [fatal][optimize] Lazy optimization failed in 1.33 secondsError: Optimizations failure.
WARNING in ./plugins/logtrail/~/html2canvas/dist/html2canvas.js
Critical dependencies:
8:484-491 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
@ ./plugins/logtrail/~/html2canvas/dist/html2canvas.js 8:484-491
Error: Optimizations failure.
WARNING in ./plugins/logtrail/~/html2canvas/dist/html2canvas.js
Critical dependencies:
8:484-491 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
@ ./plugins/logtrail/~/html2canvas/dist/html2canvas.js 8:484-491
at Object.exports.create (/opt/development/kibana/node_modules/boom/lib/index.js:21:17)
at LazyOptimizer.failedStatsToError (/opt/development/kibana/src/optimize/base_optimizer.js:224:17)
i work with kibana version: 5.5.2, elk 5.5.2
node version = 8.6.0
npm version = 5.3.0
How correct make import this libraries?