-
Notifications
You must be signed in to change notification settings - Fork 9
Description
If you find a security vulnerability, do NOT open an issue. Email [email protected] instead.
Describe the bug
When running the build process with plugin-kit and pkg-utils on a plugin project, the build fails with the error:
[error] Transform failed with 1 error: (define name):1:0: ERROR: Expected identifier but found "import"
This issue occurs even when using the provided boilerplate as a starting point for the plugin.
To Reproduce
Steps to reproduce the behavior:
Steps to reproduce the behavior:
- Create a new plugin project using the official boilerplate (sanity-plugin template).
- Run npm install to install the dependencies.
- Run npm run build.
- Observe the error during the build process:
[error] Transform failed with 1 error: (define name):1:0: ERROR: Expected identifier but found "import"
Expected behavior
The build process should complete successfully without throwing an error.
Screenshots
If applicable, add screenshots to help explain your problem.
Which versions of Sanity are you using?
Run sanity versions in the terminal and copy-paste the result here.
What operating system are you using?
macOS Sequoia 15.2
Which versions of Node.js / npm are you running?
Run npm -v && node -v in the terminal and copy-paste the result here.
npm: 10.8.3
node: v22.9.0
Additional context
This issue happens even when using the official boilerplate as a starting point, without any modifications to the provided files. I suspect the issue is related to the handling of import statements in the build process, as the project is set to use CommonJS.
Security issue?
Any security issues should be submitted directly to [email protected]. In order to determine whether you are dealing with a security issue, ask yourself these two questions:
- Can I access something that's not mine, or something I shouldn't have access to?
- Can I disable something for other people? If the answer to either of those two questions are "yes", then you're probably dealing with a security issue. Note that even if you answer "no" to both questions, you may still be dealing with a security issue, so if you're unsure, just email us at [[email protected]](mailto:[email protected].