olivernn / lunr.js

A bit like Solr, but much smaller and not as bright
http://lunrjs.com
MIT License
8.96k stars 548 forks source link

Babel es2015 issue #242

Closed evanrosa closed 7 years ago

evanrosa commented 7 years ago

Hi,

I'm currently working with lunr.js and Babel es2015 and when I test inside browsers I receive a JS error in the console (please see below for error). Is there a way to work around this? I'm trying to have my site work in all supported browsers including ie11 which why I'm using Babel in the first place. Any help would be greatly appreciated!

lunr.js:2077 Uncaught TypeError: Cannot set property 'lunr' of undefined root.lunr = factory()

evanrosa commented 7 years ago

After a lot of research, I've come across a babel plugin that seems to solve this issue. Specifically this preset does not include the transform-es2015-modules-commonjs plugin which was creating conflicts with 3rd party scripts.

https://www.npmjs.com/package/babel-preset-es2015-script