Skip to content

New v5 generate index.js feature does not account for filenames beginning with numerals #379

@ReidBraswell

Description

@ReidBraswell

🐛 Bug Report

The index.${ext} file that is now generated with v5 does not account for filenames beginning with numerals.

To Reproduce

Steps to reproduce the behavior:

  • create folder with a file named: 2circles.svg
  • run svgr cli command with --out-dir option
  • inspect created index.js file
  • output should be:
export { default as 2circles } from './2circles.svg'

Expected behavior

Since the componentName is generated from the .svg filename and prepends the Svg string to account for filenames with numerals, it would be expected for the generateIndex function to be consistent and instead return the following for the example above:

export { default as Svg2circles } from './2circles.svg';

envinfo

## System:
 - OS: Windows 10 10.0.16299
 - CPU: (4) x64 Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
 - Memory: 6.37 GB / 15.88 GB
## Binaries:
 - Node: 10.16.0 - C:\Program Files\nodejs\node.EXE
 - npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions