Recently, I've been attempting to integrate the Afinn-165 node package (https://www.npmjs.com/package/afinn-165) into my Google Chrome extension. The goal is to analyze the sentiment of text scraped from each page. Being a novice in web development, I am learning as I progress.
I have successfully installed the extension CLI using the following commands:
npx extension-cli
npm install extension-cli
Everything seemed to be working fine until I inserted the following code snippet into background.js:
import {afinn165} from 'afinn-165';
This resulted in a 'Cannot use import statement outside a module' error.
My research led me to believe that the afinn-165 package should be importable and usable within the extension. However, including this line caused the entire extension to malfunction. Other examples of extension CLI implementations utilized:
import { package } from "package";
with success. This has left me uncertain about how to proceed.