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

[@rollup/plugin-typescript] --configPlugin command option with Typescript plugin doesn't support reference option in tsconfig.json. #1755

Open
Mingeax opened this issue Aug 12, 2024 · 1 comment

Comments

@Mingeax
Copy link

Mingeax commented Aug 12, 2024

  • Rollup Plugin Name: @rollup/plugin-typescript
  • Rollup Plugin Version: 7.15.0
  • Rollup Version: v4.20.0
  • Operating System (or Browser): Windows 10
  • Node Version: v20.13.1
  • Link to reproduction (⚠️ read below): https://stackblitz.com/edit/rollup-repro-hfhjsp

Expected Behavior

Output successfully.

Actual Behavior

Throw error: Note that you need plugins to import files that are not JavaScript.

Additional Information

The rollup config file is include with the tsconfig file in references array.

@hsnMoghadasi
Copy link

same here, any solution?

tsconfig.json

{
  "files": ["./dist/atomsbuildinfo"], // this root tsconfig just exists to compose sub-projects
  "references": [
    {
      "path": "./src"
    },
    {
      "path": "./src/components/atoms"
    },
    {
      "path": "./src/components/molecules"
    },
    {
      "path": "./src/components/organisms"
    }
  ]
}

src\components\atoms\tsconfig.json


{
  "extends": "../../../tsconfig-base.json",
  "compilerOptions": {
    "outDir": "../../../dist",
    "composite": true, // needed for references sub-projects
    "rootDir": ".",
    "tsBuildInfoFile": "../../../dist/atomsbuildinfo",
    "rootDirs": [
      "../../../src",
      "../../../src/component/atoms",
      "../../../src/component/molecules",
      "../../../src/component/organisms"
    ]
  },
  "references": [
    {
      "path": "../../../src" // test project depends on src
    }
  ]
}

tsconfig-base.json


{
  // see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
  // "include": ["./src/**/*/*"],
  "compilerOptions": {
    "allowJs": true,
    // output .d.ts declaration files for consumers
    "declaration": true,
    "declarationDir": "./dist",
    // interop between ESM and CJS modules. Recommended by TS
    "esModuleInterop": true,
    // error out if import and file system have a casing mismatch. Recommended by TS
    "forceConsistentCasingInFileNames": true,
    "importHelpers": true,
    // transpile JSX to React.createElement
    "jsx": "react",
    "lib": ["dom", "esnext"],
    "module": "esnext",
    // use Node's module resolution algorithm, instead of the legacy TS one
    "moduleResolution": "node",
    // `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
    "noEmit": false,
    "noFallthroughCasesInSwitch": true,
    // linter checks for common issues
    "noImplicitReturns": true,
    // noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    // match output dir to input dir. e.g. dist/index instead of dist/src/index
    "rootDir": "./src",
    "outDir": "./dist",
    // "baseUrl": "./src",
    // "paths": {
    //   "*": ["*"]
    // },
    // significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
    "skipLibCheck": true,
    // output .js.map sourcemap files for consumers
    "sourceMap": true,
    // stricter type-checking for stronger correctness. Recommended by TS
    "strict": true,
    "typeRoots": ["./src/types", "node_modules/@types"],
    // "emitDeclarationOnly": true
    "target": "es6",
    "build": true
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants