Closed
Description
openedon Jan 18, 2023
Environment
@sentry/esbuild-plugin: 0.3.0
Steps to Reproduce
// esbuild.config.js
const sentryEsbuildPlugin = require("@sentry/esbuild-plugin");
const buildDate = Date.now();
const cp = require("child_process");
const revision = cp.execSync("git rev-parse --short HEAD").toString().trim();
const glob = require("glob");
console.log("Sentry release", revision);
require("esbuild").build({
entryPoints: glob.sync("./src/**/*.ts"),
outdir: "./dist",
bundle: false,
sourcemap: true, // Source map generation must be turned on
platform: "node",
format: "cjs",
define: {
"process.env.SENTRY_RELEASE_ID": JSON.stringify(revision),
"process.env.BUILT_DATE": JSON.stringify(buildDate),
"process.env.GIT_SHA": JSON.stringify(revision),
},
plugins: [
// Put the Sentry esbuild plugin after all other plugins
sentryEsbuildPlugin.default({
org: "funnelio",
project: "customs-error-service",
// Specify the directory containing build artifacts
include: ["dist", "src"],
// Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
// and need `project:releases` and `org:read` scopes
authToken: process.env.SENTRY_AUTH_TOKEN,
release: revision,
}),
],
});
`node esbuild.config.js && node ./dist/index.js`
Expected Result
Valid require import
Actual Result
// ./dist/types.js
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var types_exports = {};
__export(types_exports, {
connectorWebApiResponse: () => connectorWebApiResponse,
dataSourceUpdatedResponse: () => dataSourceUpdatedResponse,
dbError: () => dbError,
entity: () => entity,
getSourceTypeStatsResponse: () => getSourceTypeStatsResponse,
interval: () => interval,
jasJobComplete: () => jasJobComplete,
job: () => job,
legacyError: () => legacyError,
newSourceState: () => newSourceState,
output: () => output,
snsPayload: () => snsPayload,
source: () => source
});
module.exports = __toCommonJS(types_exports);
var import_zod = require("zod");
var import_sentry_release_injector = require("\0sentry-release-injector");
// Hidden export code that it's a bit secret/proprietary
node:internal/modules/cjs/loader:958
throw err;
^
Error: Cannot find module 'sentry-release-injector'
Require stack:
- /Users/lilja/code/customs-apis/read-errors-api/dist/types.js
- /Users/lilja/code/customs-apis/read-errors-api/dist/router.js
- /Users/lilja/code/customs-apis/read-errors-api/dist/index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:955:15)
at Module._load (node:internal/modules/cjs/loader:803:27)
at Module.require (node:internal/modules/cjs/loader:1021:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/Users/lilja/code/customs-apis/read-errors-api/dist/types.js:37:38)
at Module._compile (node:internal/modules/cjs/loader:1119:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
at Module.load (node:internal/modules/cjs/loader:997:32)
at Module._load (node:internal/modules/cjs/loader:838:12)
at Module.require (node:internal/modules/cjs/loader:1021:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/lilja/code/customs-apis/read-errors-api/dist/types.js',
'/Users/lilja/code/customs-apis/read-errors-api/dist/router.js',
'/Users/lilja/code/customs-apis/read-errors-api/dist/index.js'
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment