Skip to content

Commit

Permalink
plugins/resovlers: add back missing dns53 env var
Browse files Browse the repository at this point in the history
wrangler: gobble unrecognized node: import qualifiers
  • Loading branch information
ignoramous committed Sep 8, 2023
1 parent 78ce42b commit 5e442ff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
"max-len": [
"error",
{
code: 80,
code: 120,
ignoreComments: true,
ignoreUrls: true,
ignoreStrings: true,
Expand Down
3 changes: 2 additions & 1 deletion src/core/node/dns-transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ export function makeTransport(host, port, opts = {}) {
// and return non-null dns-answers, if recieved on-time and without errors.
export class Transport {
constructor(host, port, opts = {}) {
if (util.emptyString(host)) throw new Error("invalid host" + host);
this.host = host;
this.port = port;
this.port = port || 53;
this.connectTimeout = opts.connectTimeout || 3000; // 3s
this.ioTimeout = opts.ioTimeout || 10000; // 10s
this.ipproto = net.isIP(host); // 4, 6, or 0
Expand Down
1 change: 1 addition & 0 deletions src/plugins/dns-op/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default class DNSResolver {
if (!envutil.hasDynamicImports()) return;

const isnode = envutil.isNode();
const plainOldDnsIp = dnsutil.dnsaddr();
if (isnode && !this.nodeutil) {
this.nodeutil = await import("../../core/node/util.js");
this.log.i("imported node-util");
Expand Down
7 changes: 7 additions & 0 deletions webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ module.exports = {
},

plugins: [
// remove "node:" prefix from imports as target is webworker
// stackoverflow.com/a/73351738 and github.com/vercel/next.js/issues/28774
// github.com/Avansai/next-multilingual/blob/aaad6a7204/src/config/index.ts#L750
new webpack.NormalModuleReplacementPlugin(/node:/, (resource) => {
resource.request = resource.request.replace(/^node:/, "");
}),
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
}),
new webpack.IgnorePlugin({
resourceRegExp:
// eslint-disable-next-line max-len
/(^dgram$)|(^http2$)|(\/deno\/.*\.ts$)|(.*-deno\.ts$)|(.*\.deno\.ts$)|(\/node\/.*\.js$)|(.*-node\.js$)|(.*\.node\.js$)/,
}),
// stackoverflow.com/a/65556946
Expand Down

0 comments on commit 5e442ff

Please sign in to comment.