Hi , I don't know if this problem is caused by tsup
or @babel/parser
?
// index.ts
import parser from '@babel/parser'
const ast = parser.parse('let age = 1')
console.log(ast)
// index.js
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
// src/index.ts
var import_parser = __toESM(require("@babel/parser"));
var ast = import_parser.default.parse("let age = 1");
console.log(ast);
// tsup.confug.js
import { defineConfig } from 'tsup'
export default defineConfig({
entry: ['./src/index.ts'],
splitting: false,
sourcemap: false,
clean: true,
dts: false
})
then i run node index.js
, the following error was reported:
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too