Ignore:
Timestamp:
11/25/21 22:08:24 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
8d391a1
Parents:
59329aa
Message:

primeNG components

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/node_modules/svgo/lib/svgo-node.js

    r59329aa re29cc2e  
    1616const importConfig = async (configFile) => {
    1717  let config;
    18   try {
    19     // dynamic import expects file url instead of path and may fail
    20     // when windows path is provided
    21     const { default: imported } = await import(pathToFileURL(configFile));
    22     config = imported;
    23   } catch (importError) {
    24     // TODO remove require in v3
     18  // at the moment dynamic import may randomly fail with segfault
     19  // to workaround this for some users .cjs extension is loaded
     20  // exclusively with require
     21  if (configFile.endsWith('.cjs')) {
     22    config = require(configFile);
     23  } else {
    2524    try {
    26       config = require(configFile);
    27     } catch (requireError) {
    28       // throw original error if es module is detected
    29       if (requireError.code === 'ERR_REQUIRE_ESM') {
    30         throw importError;
    31       } else {
    32         throw requireError;
     25      // dynamic import expects file url instead of path and may fail
     26      // when windows path is provided
     27      const { default: imported } = await import(pathToFileURL(configFile));
     28      config = imported;
     29    } catch (importError) {
     30      // TODO remove require in v3
     31      try {
     32        config = require(configFile);
     33      } catch (requireError) {
     34        // throw original error if es module is detected
     35        if (requireError.code === 'ERR_REQUIRE_ESM') {
     36          throw importError;
     37        } else {
     38          throw requireError;
     39        }
    3340      }
    3441    }
Note: See TracChangeset for help on using the changeset viewer.