Please note: This issue occurs because the index.js file in the package does not get Bablified, but it should.
How can we reproduce this behavior?
Create an empty, standalone environment in a new directory.
Run yarn init and go through all the steps.
Run yarn add yoastseo.
Create a new file in the directory named index.js and paste the following code in the file:
// Altered the import to this to ensure compatibility with Node.
const { Paper, Researcher } = require( "yoastseo" );
const paper = new Paper( "Text to analyze", {
keyword: "analyze",
} );
const researcher = new Researcher( paper );
console.log( researcher.getResearch( "wordCountInText" ) );
What did you expect to happen?
While attempting to implement the Yoast SEO package in a Node.js environment, I expected to be able to run it without errors.
What happened instead?
While attempting to run my own script (i.e.
node index.js
), I was presented with the following error:Please note: This issue occurs because the
index.js
file in the package does not get Bablified, but it should.How can we reproduce this behavior?
yarn init
and go through all the steps.yarn add yoastseo
.index.js
and paste the following code in the file:node index.js
.Technical info
Which browser is affected (or browsers):