Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report]: @farmfe/js-plugin-dts cannot build TS projects with isolatedDeclarations #1783

Open
altano opened this issue Sep 17, 2024 · 1 comment
Labels
bug Something isn't working plugins feature Add new functions to the current plugin

Comments

@altano
Copy link

altano commented Sep 17, 2024

Steps to reproduce

See repro link (https://codesandbox.io/p/github/ErKeLost/react/csb-3w3kjj/draft/heuristic-satoshi) and run pnpm build to reproduce the error. Or:

Create a tsconfig.json that specifies:

{
  "compilerOptions": {
    "isolatedDeclarations": true,
...

Then try to build with farm-fe:

import { defineConfig } from "@farmfe/core";
import farmJsPluginDts from "@farmfe/js-plugin-dts";

export default defineConfig({
  compilation: {
    input: {
      index: "./src/index.ts",
    },
    // ...
  },
  plugins: [
    farmJsPluginDts({
      outputDir: "dist/farm/dts",
      tsConfigPath: "./tsconfig.json",
    }),
  ],
});

Reproduce link

https://codesandbox.io/p/github/ErKeLost/react/csb-3w3kjj/draft/heuristic-satoshi

What is actually happening?

It looks like the problematic code is here:

compilerOptions: mergeObjects(compilerOptions, {
rootDir: compilerOptions.rootDir || root,
noEmitOnError: false,
outDir: outputDir,
declarationDir: undefined,
noUnusedParameters: false,
declaration: true,
noEmit: false,
emitDeclarationOnly: true,
composite: false,
allowJs: true
} as CompilerOptions),

js-plugin-dts is overwriting the tsconfig values with no way to unset them, making certain configurations unbuildable.

System Info

System:
    OS: macOS 14.6.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 239.47 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - /Volumes/sourcecode/npm-packages/.devbox/nix/profile/default/bin/node
    npm: 10.2.4 - /Volumes/sourcecode/npm-packages/.devbox/nix/profile/default/bin/npm
    pnpm: 9.10.0 - /Volumes/sourcecode/npm-packages/.devbox/virtenv/nodejs/corepack-bin/pnpm
    bun: 1.0.7 - ~/.bun/bin/bun
  Browsers:
    Chrome: 128.0.6613.138
    Firefox Nightly: 126.0a1
    Safari: 17.6
  npmPackages:
    @farmfe/core: ^1.3.21 => 1.3.21
@ErKeLost
Copy link
Member

I will resolve this later thank you for your use and report issues

@fu050409 fu050409 added bug Something isn't working plugins feature Add new functions to the current plugin labels Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugins feature Add new functions to the current plugin
Projects
None yet
Development

No branches or pull requests

3 participants