mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 23:52:54 +00:00

V8 and Node.js had defined `NOMINMAX` on Windows for a long time. In recent changes, V8 added `std::numeric_limits::min` usages in its header files which caused addons without `NOMINMAX` defines failed to compile. Define `NOMINMAX` in common.gypi so that addons can be compiled with the latest V8 header files. PR-URL: https://github.com/nodejs/node/pull/52794 Fixes: https://github.com/nodejs/nan/issues/968 Refs: https://github.com/nodejs/gyp-next/pull/244 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
22 lines
717 B
C++
22 lines
717 B
C++
// Include uv.h and v8.h ahead of node.h to verify that node.h doesn't need to
|
|
// be included first. Disable clang-format as it will sort the include lists.
|
|
// clang-format off
|
|
#include <uv.h>
|
|
#include <v8.h>
|
|
#include <node.h>
|
|
// clang-format on
|
|
|
|
static void Method(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|
v8::Isolate* isolate = args.GetIsolate();
|
|
args.GetReturnValue().Set(
|
|
v8::String::NewFromUtf8(isolate, "world").ToLocalChecked());
|
|
}
|
|
|
|
static void InitModule(v8::Local<v8::Object> exports,
|
|
v8::Local<v8::Value> module,
|
|
v8::Local<v8::Context> context) {
|
|
NODE_SET_METHOD(exports, "hello", Method);
|
|
}
|
|
|
|
NODE_MODULE(NODE_GYP_MODULE_NAME, InitModule)
|