Hello,
Fuse does'nt work with React Native since 3.X
Importing Fuse in a react-native projet causes an issue with babel-plugin-add-module-exports :
TransformError: [鈥/node_modules/fuse.js/dist/fuse.js: Unknown plugin "babel-plugin-add-module-exports" specified in "[鈥/node_modules/fuse.js/.babelrc" at 0, attempted to resolve relative to "[鈥/node_modules/fuse.js"
Is there an extra step to do on a react-native project ?
Thank's
I am having this same issue. I am trying to import/require it in all kinds of ways. I am also using this in a react-native project.
I tried the following ways:
const Fuse = require('fuse.js/dist/fuse.js');
const Fuse = require('fuse.js/src');
const Fuse = require('fuse.js');
import Fuse from 'fuse.js'
import Fuse from 'fuse.js/src'
import Fuse from 'fuse.js/dist/fuse'
What I did was copy the the src dir from node_modules/fuse.js/src and pasted it into my ./app/ dir but renamed it to fuse. So from ./node_modules/fuse.js/src to ./app/fuse and then I import it like this:
const Fuse = require('./fuse');
Its a workaround for now.
Thank you @krisk for such a fast fix! I didn't test it yet but will sure do so soon :)
The last version available in npm 3.0.5 doesn't have .babelrc in .npmignore file yet.
Thanks @krisk for your amazing work with fuse.
Hey there, following the discussion, @krisk would you mind publish a release to npm?
Thanks in advance!
try import Fuse from 'fuse.js/src';
@defualt Solution worked for me !
Most helpful comment
try
import Fuse from 'fuse.js/src';