Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Build fails for ESM modules #751

Open
mdesousa opened this issue Feb 25, 2024 · 1 comment
Open

[Bug]: Build fails for ESM modules #751

mdesousa opened this issue Feb 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mdesousa
Copy link

Bug Description

We are trying to build a zapier project using "type": "module" in the package.json file. We need this to be able to reference ESM dependencies. The code builds, but when we run zapier push we get the error below:

zapierwrapper.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.

Reproduction Steps

  1. Create a new integration with zapier init
  2. Set "type": "module" in the package.json
  3. Run zapier push

Zapier Platform version

15.5.3

Node.js version

18.5.0

Your Operating System

darwin-arm64

npm/yarn version

9.6.7

App ID

No response

More Details

No response

@mdesousa mdesousa added the bug Something isn't working label Feb 25, 2024
@u9520107
Copy link

Not sure if this is directly related. But I tried to add axios@1.6.7 as a dependency, and was finding that zapier push is not including all the files properly.
Yet, axios@0.28.0 works find. The main difference that I can see between the 2 versions is that 1.6.7 uses the import/export syntax, whereas 0.28.0 is the old school require function call.
I guess the smart dependency detection is not working with import/export syntax used by the node_modules?

Using import/export in typescript is fine as currently they get transpiled into require calls. But if the packages in node_modules themselves are using import/export, then things seems to be broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants