javascript
javascript copied to clipboard
Use yoastseo package in Node app
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?
I'm also stuck on this... Have you managed to solve this issue?
@Cool-Programmer no, we dropped this feature.