Using NPM/Yarn to install Semantic UI packages for some plugins results in "module not resolved"

Using NPM/Yarn to install Semantic UI packages for some plugins results in "module not resolved"

fieryprophetfieryprophet Posts: 1Questions: 1Answers: 0

Running something like this:

yarn add datatables.net-se
yarn add datatables.net-colreorder-se

and adding these requires to my bootstrap:

require( 'datatables.net-se' )();
require( 'datatables.net-colreorder-se' )();

results in "module datatables.net-colreorder-se could not be resolved" errors when I run yarn run dev

It looks like the issue for the datatables.net-colreorder-se package is that it does not include the expected /js/ directory that is located in the original datatables.net-colreorder package, even though it declares it as a dependency. It only includes the /css/ folder, but a plugin like datatables-responsive-se includes both the /js/ and /css/ directories and does not present the same error when being required.

Answers

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    Apologies - yes. There is no Semantic UI Javascript file for ColReorder (or any of the other integrations). The integration only needs a CSS file.

    So you'd need to do require( 'datatables.net-colreorder' ); for the Javascript.

    That's a bit of a flaw in my npm / yarn packaging. I'm not sure if I should add basically empty integration files so everything is consistent with the includes, or the download builder should reflect that correct (that it doesn't at the moment is a bug).

    Out of interest, how are you including your CSS stuff?

    Thanks,
    Allan

This discussion has been closed.