Closed alexFaunt closed 8 years ago
Hi @alexFaunt. I believe you need to remove the "node_modules/" from the beginning of the target string. The alias should look like "react-router": "preact-compat/-router"
Hi @ilearnio In my use case I don't want it to replace 'react-router' with anything. I want 'react' to be replaced with 'preact-compat' and 'react-router' to remain as it is.
But as it just matches the start of the string it replaces both and breaks the react-router import.
I just fixed this issue and updated the npm package to v2.0.0 (since it's a breaking change). Try to upgrade and please leave a note if it works well for you now.
👍 Perfect, thanks
Hi,
I started to use this to alias 'react' to 'node_modules/preact-compat' but that has the side effect of matching 'react-router' to 'node_modules/preact-compat/-router'
Line 25 matches if the module starts with the alias or not
request.indexOf(alias) === 0
an exact match fixes my problem as inrequest === alias
Or is it intentional that it matches partials too?
Cheers