I am trying to implement Rollup and Typescript for a monorepo. I am running into a problem where I am getting Typescript issues from dependancies which they themselves are projects within the monorepo. I am using pnpm and Lerna to manage my monorepo. It seems like rollup is attempting to run against the modules for project-b even though they are coming from node_modules.
I would provide code, but I would have to write a lot of it. I have created a repo in GitHub which reproduces the problem.
There is a README in this repo with the steps to reproduce the issue.
https://github.com/CodeMedic42/rollup-issue/tree/main
I will, however, provide the Rollup config and the TypeScript config that I have using.
Rollup
import { defineConfig } from 'rollup';
import path from 'path';
import pluginTs from '@rollup/plugin-typescript';
export default defineConfig([
{
input: path.join(process.cwd(), 'src/index.ts'),
output: [
{
dir: 'dist',
format: 'es',
entryFileNames: '[name].mjs',
preserveModules: true,
sourcemap: true,
},
],
plugins: [
pluginTs(),
],
},
])
Typescript
{
"compilerOptions": {
"target": "es2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ES2020",
"moduleResolution": "Bundler",
"jsx": "react-jsx",
"baseUrl": "./src",
"noEmit": true,
"isolatedModules": true,
"esModuleInterop": true,
"strict": true,
"checkJs": true
},
"exclude": [
"dist/**/*",
"node_modules/**/*"
]
}