[Feature Request]: Support for uploading Zapier integrations of type Module
Current Behavior
After running zapier init --template=typescript zapier-app, I've modified the following two files:
package.json
...
"type": "module",
...
and
tsconfig.json
...
"module": "ESNext",
"moduleResolution": "Bundler",
...
When I now run zapier validate, I see an error related to running the zapier cli with a project of type module:
zapier validate
Validating project locally
(node:64821) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
› Error: require() of ES Module /path/test-zapier-app/example-app/index.js from
› /Users/user/.nvm/versions/node/v21.6.2/lib/node_modules/zapier-platform-cli/src/utils/local.js not supported.
› index.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
› Instead either rename index.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in
› /path/test-zapier-app/example-app/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
›
›
› re-run this command with `--debug` for more info
Other zapier CLI commands result in similar errors.
Desired Behavior / Feature Request
All zapier CLI commands work with projects of type "module".
I am also seeing this error whenever I run any zapier CLI commands. Here's the error I'm seeing and some info on my versions and project package.json file:
(Note that I've redacted some identifying info with xxx).
Here's the deprecation warning that appears for every zapier command I enter:
$ zapier versions
⠋ Loading versions(node:195258) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
✔ Loading versions
...
Here's the modules that are using punycode:
$ npm ls punycode
[email protected] /home/xxx
└─┬ [email protected]
└─┬ [email protected]
├── [email protected]
└─┬ [email protected]
└── [email protected] deduped
$ npm --version
10.9.2
$ node --version
v22.12.0
Contents of package.json:
{
"name": "xxx",
"version": "X.Y.Z",
"description": "xxx",
"homepage": "xxx",
"main": "index.js",
"scripts": {
"predeploy": "zapier test",
"deploy": "zapier push",
"test": "cross-env ZAPIER_KEY=yup ZAPIER_SECRET=S3cr3t! ENCRYPTION_KEY=yakkafoobmog nyc --reporter=lcov --reporter=text-summary mocha \"./{,!(node_modules|__mocks__)/**/}*.spec.js\""
},
"engines": {
"node": ">=12.0.0",
"npm": ">=5.6.0"
},
"dependencies": {
"xxx": "^5.0.0",
"xxx": "^1.3.0",
"dlv": "^1.1.3",
"inso": "^1.0.0",
"thenby": "^1.3.0",
"zapier-platform-cli": "16.0.0",
"zapier-platform-core": "16.0.0"
},
"devDependencies": {
"cross-env": "^5.2.0",
"husky": "^3.0.3",
"lcov-summary": "^1.0.1",
"mocha": "^5.2.0",
"nyc": "^14.1.1",
"prettier": "^1.18.2",
"pretty-quick": "^1.11.1",
"should": "^13.2.0",
"should-sinon": "0.0.6",
"should-spies": "^1.1.0",
"sinon": "^7.4.1"
},
"nyc": {
"all": true,
"include": [
"**/*.js"
],
"exclude": [
"__mocks__",
"node_modules",
"build",
"coverage",
"**/*.spec.js",
"appendCoverageResults.js"
]
},
"husky": {
"hooks": {
"pre-commit": "cross-env ZAPIER_KEY=yup ZAPIER_SECRET=S3cr3t! nyc --reporter=text-summary mocha \"./{,!(node_modules|__mocks__)/**/}*.spec.js\" > coverage/lcov.txt && node appendCoverageResults.js && git add . && pretty-quick --staged && git add ."
}
},
"prettier": {
"singleQuote": true
}
}
Thanks for reporting! We'll fix these issues with ES modules in v17, which we plan to release in Q1 2025.
ESM is now supported in v17. Closing.