Skip to content

Can't make it work #9

Description

@n1kk

Hi, thanks for the library, this looks like a great idea.

I tried following the instruction but I can't make it work for some reason.

I have a simple vite setup, I've installed library as pnpm i -D comptime.ts and added it to vite config:

import { defineConfig } from "vite";
import { comptime } from "comptime.ts/vite";

export default defineConfig(() => {
  return {
    plugins: [comptime()],
  };
});

I've created a sample file

// util.comptime.ts
export function sum(a: number, b: number): number {
  return a + b;
}

And trying to import it and use it in another file

import { sum } from "../../util.comptime" with { type: "comptime" };
console.log(sum(123, 234));

But I still get it included into the build and minified as ...function G(e,n){return e+n}console.log(G(123,234));....

I've tried using the comptime() function too, but it gets whole library included into the build.

Would be nice to have a folder with some example setups to look at and figure out what I did wrong.

I'm using Node v24 with these deps:

  "devDependencies": {
    "@types/node": "^24.10.4",
    "comptime.ts": "^0.8.0",
    "prettier": "^3.7.4",
    "typescript": "~5.9.3",
    "vite": "^7.3.0",
    "vitest": "^4.0.15"
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions