Skip to content

Plugin generates invalid JavaScript when file name starts with a number. #9

@JakMobius

Description

@JakMobius

With the following project structure:

├─loader.ts
├┬models
│└┬─1model.ts
│ └─2model.ts

loader.ts:

import Models from './models/*'
console.log(Models)

model/1model.ts:

export default "1model"

model/2model.ts

export default "2model"

This project fails to compile with 'Identifier directly after number' error. After figuring out what's going on here, it turns out that the plugin generates the following code:

...
const Models = {
  1model: _model1.default,
  2model: _model2.default,
};
...

The plugin does not seem to handle cases where file names start with a number

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