mincho-js / mincho

Natural CSS in TypeScript
MIT License
40 stars 0 forks source link

Bundler setup #35

Closed black7375 closed 3 months ago

black7375 commented 3 months ago

Description

1. Dependency

The current bundling settings are incorrect. For Node.js library packages, you don't need to include all dependencies.

2. Modueles

Should be support both ESM and CJS. The files are formatted as follows:

// CJS TS must be specified as `cts`
{
  "type": "module",
  "exports": {
    ".": {
      "require": {
        "types": "./index.d.cts",
        "default": "./index.cjs"
      },
      "import": {
        "types": "./index.d.ts",
        "default": "./index.js"
      }
    }
  }
}

3. Vite plugin for debugLog

I want to use debugLog as a vite plugin.

if (import.meta.vitest) {
  const { describe, it, expect } = import.meta.vitest;
  const { jsonLog } = import.meta.debugLog;

  describe.concurrent("testSuite", () => {
     jsonLog({ a: 1 });
     // will be test
  });
}