-
Notifications
You must be signed in to change notification settings - Fork 40
Module objects cannot be functions (should use a named export) #74
Comments
I think I'm missing context here. Why are you importing this package that way? |
@stephenmathieson sorry, I don't follow your question. Are you wondering why I'm importing the module like |
@JoshuaKGoldberg right... We don't strictly support ES modules here. Instead, we use Node's funky interpretation of CommonJS (where a function/class can take the place of the pseudo "default" export). This was the standard for years, and is still the way many packages are written to date. I think you're probably looking for a TypeScript (or alike) compatible export, which would require us to provide On a side note, wouldn't |
Closes #74 ## Reviewer checks **Required fields, to be filled out by PR reviewer(s)** - [x] Follows the commit message policy, appropriate for next version - [x] Has documentation updated, a DU ticket, or requires no documentation change - [x] Includes new tests, or was unnecessary - [x] Code is reviewed for security by: @WilcoFiers
This is not valid JavaScript:
See this SO answer:
...so what should happen instead is:
🙃.
Fortunately, this can be a purely additive change: somewhere in
lib/index.js
, you can add:...so that both the CommonJS-style
const AxeBuilder = require("axe-webdriverjs");
and ES-style above orconst AxeBuilder = require("axe-webdriverjs").AxeBuilder;
will work.The text was updated successfully, but these errors were encountered: