1

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

Larsi
  • 4,654
  • 7
  • 46
  • 75
  • 3
    Possible duplicate of [Pass options to ES6 module imports](http://stackoverflow.com/questions/29923879/pass-options-to-es6-module-imports) – Bergi Feb 09 '16 at 09:48
  • Agree that my question it is a duplicate, but based on just a short glance I did not realize that it was a duplicate. I think the example in my question might by more relevant to people not familiar with the require syntax. But again - feel free to close. – Larsi Feb 10 '16 at 08:54

1 Answers1

1

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,$);
madox2
  • 49,493
  • 17
  • 99
  • 99