DataTables Concated Script in Webpack throws error

DataTables Concated Script in Webpack throws error

core_javacore_java Posts: 13Questions: 4Answers: 0

Can't resolve 'datatables.net-bs'

mix.js('resources/assets/js/app.js', 'public/app.min.js')

// app.js file

import {} from '@/public/assets/js/DataTables/dataTables.Responsive.Buttons';

const app = function(){
return {
init : function(){
console.log($.fn.dataTable);
}
};
}();
(function (app) {
app.init();
return app;
}(app));

I can't use as // CommonJS is calling
I want to call else part of code
// Browser
factory( jQuery, window, document );

How to configure webpack to allow me to call browser part

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Do you have some kind of configuration somewhere telling webpack that datatables.net-bs is in your concatenated script?

    Allan

  • core_javacore_java Posts: 13Questions: 4Answers: 0
    edited January 2018

    No.

    I build 'public/assets/js/DataTables/dataTables.Responsive.Buttons.js'

    which is concatenated of different plugins.

  • core_javacore_java Posts: 13Questions: 4Answers: 0

    I created datatables.js which is concanated of other dataTable plugin files.

    Now I import that file and run mix.js which calls commonjs portion in datatable.js which have dependency of require('datatable.net');

    now I don't want to use package.js to include that package still want to use that plugin.
    I want to restrict that plugin from node_modules so I can use my concanated plugin file and import that file.

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    I'm afraid that I'm out of my depth with that one in that case. You'll need to ask in a WebPack specific forum.

    Allan

  • core_javacore_java Posts: 13Questions: 4Answers: 0

    Ok thank you

This discussion has been closed.