Step 2: Import the Library

Next, import and initialize the core library in your application.

Bundle Options

ES6

If you already handle polyfills in your application, we’d recommend the ES6 bundle. This uses ES6 module syntax, but can be run through Babel version 5 and up.

import { provideCore } from '@yext/search-core';

ES5

To use the ES5 bundle, use the @yext/search-core/legacy bundle instead. This bundle supports browsers like Internet Explorer 11 out of the box.

import { provideCore } from '@yext/search-core/legacy';

Code Sandbox Vanilla JS Example

We’ll use the ES6 Bundle for our Vanilla JS example. In your index.ts file, import the library,a nd feel free to remove the additional JS on the page:

import { provideCore } from '@yext/search-core';

// remove the following
// document.getElementById("app").innerHTML = `
// <h1>Hello Parcel!</h1>
// <div>
//   Look
//   <a href="https://parceljs.org" target="_blank" rel="noopener noreferrer">here</a>
//   for more info about Parcel.
// </div>
// `;
Feedback