javascript icon indicating copy to clipboard operation
javascript copied to clipboard

Use yoastseo package in Node app

Open cbratschi opened this issue 6 years ago • 2 comments

Explanation

require('yoastseo') fails because index.js is a module.

import { Paper, Researcher } from '../node_modules/yoastseo/index';
       ^

SyntaxError: Unexpected token {
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)

Technical decisions

Index.js should be renamed to index.mjs to allow Node.js to instantiate the module correctly.

Feedback?

cbratschi avatar Oct 10 '19 10:10 cbratschi

I'm also stuck on this... Have you managed to solve this issue?

Cool-Programmer avatar Jan 19 '20 15:01 Cool-Programmer

@Cool-Programmer no, we dropped this feature.

cbratschi avatar Jan 20 '20 09:01 cbratschi