Skip to content

v1.1.4 generates code with syntax error #10

@satazor

Description

@satazor

v1.1.4 generates code with syntax error. The follow code is injected in the built files:

function (filepath, extMapping) {
  if (!filepath.startsWith('./') && !filepath.startsWith('../')) {
    // Package import
    return filepath;
  }
  const idx = filepath.lastIndexOf('.');
  if (idx === -1 || filepath.includes('/', idx)) {
    // No extension
    const newExt = extMapping[''];
    if (newExt) {
      return filepath + newExt;
    }
    return filepath;
  }
  for (let [origExt, newExt] of Object.entries(extMapping).sort((a, b) => b[0].length - a[0].length)) {
    if (filepath.endsWith(origExt)) {
      return filepath.slice(0, -origExt.length) + newExt;
    }
  }
  return filepath;
}

Which is invalid JS, since the function has no name. v1.1.3 works great.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions