Project Files
rollup.config.mjs
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
const baseConfig = {
external: [
"@lmstudio/sdk",
"axios",
"zod",
"zod-to-json-schema",
// native / platform or large libs we don't want to bundle
"@grpc/grpc-js",
"@grpc/proto-loader",
"protobufjs",
/@protobufjs\/.*/,
"path",
"fs",
"os",
"url",
"util",
"node:path",
"node:fs",
"node:os",
"node:url",
"node:util",
"sharp",
// native packages and their loaders – keep external to avoid ESM __dirname issues
"classic-level",
"node-gyp-build",
// sql.js uses WASM and doesn't bundle well
"sql.js",
],
// Silence known circular/eval warnings from third-party packages
onwarn(warning, warn) {
const importer = String(warning.importer || '');
if (warning.code === 'CIRCULAR_DEPENDENCY') {
if (/zod-to-json-schema|gifwrap|xmlbuilder|file-type/.test(importer)) return;
}
if (warning.code === 'EVAL') {
if (/file-type\/.+core\.js/.test(importer) || /file-type/.test(String(warning.message || ''))) return;
}
warn(warning);
},
plugins: [
resolve({ exportConditions: ["node"], preferBuiltins: true }),
commonjs({ include: /node_modules/, requireReturnsDefault: "auto" }),
json(),
],
};
export default [
// LM Studio Plugin Tools Provider bundle
{
input: "dist-temp/src/index.js",
output: {
file: "dist/index.js",
format: "cjs",
exports: "named",
inlineDynamicImports: true,
sourcemap: false,
},
...baseConfig,
},
];