-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
hexoid is not a function error upon plugin registration on server start #366
Comments
I have non idea. My hunch would be to look into the webpack config or stop using webpack altogether. |
This is 100% not a problem of this module. |
@SaundersB I have the same issue with webpack and a former version of
"externalDependencies": [
"fastify-multipart"
] I suppose in yours it'll be something like: module.exports = {
//...
externals: '@fastify/multipart',
}; |
Can I integrate my perf optimized hexoid jit into fastify-multipart? |
@mcollina I think the problem is that the way hexoid is imported in this module is incompatible with ES6. The default export of that module can be accessed by require('hexoid').default, and that works fine with webpack/babel. "according to the ES6 module spec, a default export is no different than a named export with the name default. It is just syntactic sugar which can be statically resolved at compile time" |
For anyone looking for a quick hacky solution without fixing this module, it's possible from webpack to patch the bad code by adding the following rule:
|
@Uzlopak go ahead with integrating your lib |
You have luck, I prepared yesterday something after seeing this issue ;) |
Prerequisites
Fastify version
4.2.0
Plugin version
7.1.0
Node.js version
16.15.1
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
12.4
Description
I'm seeing an error with the hexoid library when I register this plugin with my fastify API:
Is there a reason this plugin wouldn't see one of the libraries fastify-multipart declared in the fastify-multipart package.json?
I've made sure I didn't do anything silly like forget to
npm i
in my root project.My usage inside a plugin of my own:
which I then register when I run the server with out plugins:
Steps to Reproduce
Expected Behavior
the API should start without issue and then allow me to accept multipart form content-type. right now my API only accepts application/json as expected via fastify. however, since the API doesn't start I can't use plugin.
The text was updated successfully, but these errors were encountered: