risen228 / craco-alias

A craco plugin for automatic aliases generation for Webpack and Jest
MIT License
109 stars 11 forks source link

$ is not escaped in Jest aliases #9

Closed vlopp closed 4 years ago

vlopp commented 4 years ago

tsconfig.extend.json

{
  "compilerOptions": {
    "baseUrl": "./src",
    "paths": {
      "$redux/*": ["redux/*"]
    }
  }
}

Relevant excerpt from craco.config.js

  plugins: [
    {
      plugin: CracoAlias,
      options: {
        baseUrl: "./src",
        tsConfigPath: "./tsconfig.extend.json",
        source: "tsconfig",
        debug:true
      }
    }
  ],

Produced Jest alias, as reported by the craco-alias debug output.

`"^$redux/(.*)$": "E:\\myProject\\src\\redux/$1"`

Issue: the dollar sign in the Jest regex is not escaped. Should be "^\$redux/(.*)$"

risen228 commented 4 years ago

@vlopp Should be fixed in v2.1.1