I’m working off the default project template that’s created by Figma. I’ve installed xlsx into my project (https://www.npmjs.com/package/xlsx), and I can import into my code.ts without any errors:
import * as XLSX from './node_modules/xlsx/types/index'
That projects comes with it’s own typings.
However, when I run the plugin, it crashes immediately with: Error: Syntax error on line 1: Unexpected token.
I’ve tried switching it to this style of import with the same result:
import { set_fs, utils, writeFile } from './node_modules/xlsx/types/index';
I’ve ensured that the typings root for xlsx is in tsconfig:
"typeRoots": [
"./node_modules/@types",
"./node_modules/@figma",
"./node_modules/xlsx/types"
]
Without the import statement in my ts file, vs code doesn’t recognize my usage of XLSX (which is kinda thought was part of the point of providing a typings file).
Any tips for how to properly configure my project? Could it just be that this xlsx library is not supported?
Edit: Not sure if this is related, but I see errors in my @figma\plugin-typings file:
And a lot of similar sounding errors in node typings files as. It’s gotta be some sort of issue with my project configuration, but I’m at a loss as to what.