2.0 error with importmaps

2.0 error with importmaps

tacman1123tacman1123 Posts: 181Questions: 41Answers: 1

I updated by libraries, and am getting something peculiar that makes me think I have the wrong libraries.

The error is SyntaxError: The requested module 'datatables.net' does not provide an export named 'default' (at datatables.net-bs5.index-3e472a948fa3a14c2fd9c23a81e9ecf5.js:7:30)

on this line: "export {default} from "datatables.net";"

**
 * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
 * Original file: /npm/datatables.net-bs5@1.13.11/js/dataTables.bootstrap5.mjs
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
import a from "jquery";
import e from "datatables.net";
export {default} from "datatables.net";
/*! DataTables Bootstrap 5 integration
 * 2020 SpryMedia Ltd - datatables.net/license
 */

/ff.wip/favicon.ico 404 (Not Found)
5datatables.net-bs5.index-3e472a948fa3a14c2fd9c23a81e9ecf5.js:7 Uncaught (in promise) SyntaxError: The requested module 'datatables.net' does not provide an export named 'default' (at datatables.net-bs5.index-3e472a948fa3a14c2fd9c23a81e9ecf5.js:7:30)

This is happening locally, I'll try to publish it somewhere if that helps. It does look like all the jsdelivr libraries were updated.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    I'd need a way to reproduce this really, but dataTables.mjs definitely does export a default - you can see it on the last line here. I wonderif you might be using the UMD files (.js) rather than the ESM ones (.mjs).

    Allan

  • tacman1123tacman1123 Posts: 181Questions: 41Answers: 1

    something's amiss with the importmap libraries on jsdelivr.

    bin/console importmap:outdated
     ----------------------------------------------------------------------- --------- -------- 
      Package                                                                 Current   Latest  
     ----------------------------------------------------------------------- --------- -------- 
      bootstrap                                                               5.3.2     5.3.3   
      bootstrap/dist/css/bootstrap.min.css                                    5.3.2     5.3.3   
      datatables.net-bs5                                                      1.13.8    2.0.1   
      datatables.net                                                          1.13.8    2.0.1   
      datatables.net-bs5/css/dataTables.bootstrap5.min.css                    1.13.8    2.0.1   
      axios                                                                   1.6.5     1.6.7   
      datatables.net-searchpanes-bs5                                          2.2.0     2.3.0   
      datatables.net-searchpanes-bs5/css/searchPanes.bootstrap5.min.css       2.2.0     2.3.0   
      datatables.net-dt                                                       1.13.8    2.0.1   
      datatables.net-dt/css/jquery.dataTables.min.css                         1.13.8    2.0.1   
      datatables.net-responsive                                               2.5.0     3.0.0   
      datatables.net-select-bs5                                               1.7.0     2.0.0   
      datatables.net-select-bs5/css/select.bootstrap5.min.css                 1.7.0     2.0.0   
      datatables.net-buttons-bs5                                              2.4.2     3.0.0   
      datatables.net-buttons                                                  2.4.2     3.0.0   
      datatables.net-buttons-bs5/css/buttons.bootstrap5.min.css               2.4.2     3.0.0   
      datatables.net-responsive-bs5                                           2.5.0     3.0.0   
      datatables.net-responsive-bs5/css/responsive.bootstrap5.min.css         2.5.0     3.0.0   
      datatables.net-scroller-bs5                                             2.3.0     2.4.0   
      datatables.net-scroller                                                 2.3.0     2.4.0   
      datatables.net-scroller-bs5/css/scroller.bootstrap5.min.css             2.3.0     2.4.0   
      datatables.net-select                                                   1.7.0     2.0.0   
      datatables.net-searchpanes                                              2.2.0     2.3.0   
      datatables.net-searchbuilder-bs5                                        1.6.0     1.7.0   
      datatables.net-searchbuilder                                            1.6.0     1.7.0   
      datatables.net-searchbuilder-bs5/css/searchBuilder.bootstrap5.min.css   1.6.0     1.7.0   
     ----------------------------------------------------------------------- --------- -------- 
    tac@tac-XPS-9320:~/g/sites/dt-demo$ bin/console importmap:install
    
                                                                                                                            
     [OK] No assets to install.                                                                                             
                                                                                                                            
    
    tac@tac-XPS-9320:~/g/sites/dt-demo$ bin/console importmap:update
    
    In JsDelivrEsmResolver.php line 123:
                                                                                                                                                                                                 
      Error 404 requiring packages from jsDelivr for "datatables.net-dt/css/jquery.dataTables.min.css". Check your package names. Response: Couldn't find the requested file /css/jquery.dataTa  
      bles.min.css in datatables.net-dt.                                                                                                                                                         
                                                                                                                                                                                                 
    
    In CommonResponseTrait.php line 173:
                                                                                                                      
      HTTP/2 404  returned for "https://cdn.jsdelivr.net/npm/datatables.net-dt@2.0.1/css/jquery.dataTables.min.css".  
                                                                                                                      
    
    importmap:update [<packages>...]
    
    tac@tac-XPS-9320:~/g/sites/dt-demo$ git diff importmap.php
    tac@tac-XPS-9320:~/g/sites/dt-demo$ 
    
    
    
  • tacman1123tacman1123 Posts: 181Questions: 41Answers: 1

    Hmm, gut feeling is that it's related to your library updated.

    Nonetheless, I've opened an issue in the assetmapper component:

    https://github.com/symfony/symfony/issues/54096

    It's really easy to install and see the error, at least the installation error, please participate there if it makes sense.

    It's not the update to the asset-mapper component, though. Because the update fails even in the current version, which has been working for months, and without any changes except updating to the datatables libraries, the issue happens.

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    Answer ✓

    datatables.net-dt/css/jquery.dataTables.min.css

    This part at least is wrong (it resolves to a 404 later in the message that you quote.

    The correct file is now named datatables.net-dt/css/dataTables.dataTables.min.css. Same file, different name.

    Is that file defined in your package somewhere? I'm not clear on where that would be defined?

    Allan

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Hmmm that file is referenced for DataTables 1.13.8. It still exists there. But not in 2.x. I'm not clear on why the version referenced is 1.x, but it is pulling in 2.x?

    Allan

  • tacman1123tacman1123 Posts: 181Questions: 41Answers: 1

    yes, removing that helped. Not sure how the Symfony tool should handle moved / missing files.

  • tacman1123tacman1123 Posts: 181Questions: 41Answers: 1

    Removing the files that were renamed seems have solved the problem. Thanks!

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Awesome. Thanks for letting me know.

    Allan

Sign In or Register to comment.