trayio / babel-plugin-webpack-alias

babel 6 plugin which allows to use webpack resolve options
MIT License
150 stars 32 forks source link

Escape alias before creating a regexp from it #51

Closed halbgut closed 5 years ago

halbgut commented 7 years ago

Currently the plugin doesn't work if an alias has a "Regular Expression special char" in it. This PR fixes that.

Example:

...
  alias: {
    '$somethingsomething': '/somethingelse'
  }
...

For another example see added test.

codecov-io commented 7 years ago

Codecov Report

Merging #51 into master will increase coverage by 0.06%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #51      +/-   ##
==========================================
+ Coverage   94.38%   94.44%   +0.06%     
==========================================
  Files           1        1              
  Lines          89       90       +1     
==========================================
+ Hits           84       85       +1     
  Misses          5        5
Impacted Files Coverage Δ
src/index.js 94.44% <100%> (+0.06%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update cb486b7...a0b1a5b. Read the comment docs.