לבסוף מצאתי איזה ריפו ישן ב - GitHub שעל פיו הוספתי את הקבצים הבאים:
// webpack.config.js
const path = require("path");
module.exports = {
entry: "./src/index",
mode: "production",
output: {
globalObject: "this",
path: path.resolve(__dirname, "dist"),
filename: "drop-word-script.js",
},
module: {
rules: [
{
test: /\.(ts|js)$/,
loader: "babel-loader",
options: {
presets: [["@babel/preset-env", { loose: true, modules: "commonjs" }], "@babel/preset-typescript"],
},
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
optimization: {
minimize: false, // minification may produce syntax errors because ExtendScript does not support nested ternary operators without parentheses
},
target: "browserslist",
};
// tsconfig.json
{
"compilerOptions": {
"target": "ES6",
"module": "CommonJS",
"moduleResolution": "Node",
"noEmit": true,
"skipLibCheck": true,
"types": [
"types-for-adobe/InDesign/2021"
]
},
}
// package.json
{
"name": "drop-word-script",
"version": "1.0.0",
"main": "dist/drop-word-script.js",
"scripts": {
"build": "npm run check-types && npm run build:bundle",
"build:bundle": "webpack",
"build:compile": "npx jsxbin -i dist/drop-word-script.js -o dist/drop-word-script.jsxbin",
"check-types": "tsc --noEmit"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.4",
"@babel/preset-typescript": "^7.24.7",
"babel-loader": "9.1.3",
"jsxbin": "^2.2.0",
"types-for-adobe": "^7.2.1",
"typescript": "^5.6.2",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4"
}
}
// .browserslistrc
ie 6
אשמח לשמוע אם יש מקום לשיפור