Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Has anyone tried modifying elasticlunr to not use global variables? #148

Open
Jieiku opened this issue Aug 26, 2023 · 1 comment
Open

Has anyone tried modifying elasticlunr to not use global variables? #148

Jieiku opened this issue Aug 26, 2023 · 1 comment

Comments

@Jieiku
Copy link

Jieiku commented Aug 26, 2023

Has anyone tried modifying elasticlunr to not use global variables?

I use elasticlunr in my Zola site. https://abridge.netlify.app/ (repo)

2023-08-25_22-07-02

@giovw
Copy link

giovw commented Sep 7, 2024

My solution en Vuejs with Vite
In file vite.config.js

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';

// Identifica si el comando actual es para servir la aplicación en desarrollo
const isDevelopment = process.env.NODE_ENV !== 'production';

export default defineConfig({
plugins: [vue()],
define: {
// En producción, redefine lunr como una variable global con elasticlunr
'lunr': 'window.elasticlunr'
}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants