Reputation: 4774
Are there any ways I could execute the import inline? See example below:
import $ from 'jquery';
import dt from 'datatables.net-bs';
import dtbuttons from 'datatables.net-buttons-bs';
import csv from 'datatables.net-buttons/js/buttons.html5.js';
// Attach the plugin - Could this be done inline in the import statments above?
dt(window,$);
dtbuttons(window,$);
csv(window,$);
Larsi
Upvotes: 1
Views: 401
Reputation: 51931
It is not possible with import statement. You can do it with different module loader. For example it is possible with node's built-in require
:
import $ from 'jquery';
require('datatables.net-bs')(window, $);
require('datatables.net-buttons-bs')(window,$);
require('datatables.net-buttons/js/buttons.html5.js')(window,$);
Upvotes: 1