Trying to build a module with rollup + TypeScript and seeing some issues I cannot understand.
My general rollup config looks like:
export default {
input: ['src/index.ts'],
output: [
{
preserveModules: true,
dir: 'dist',
format: 'esm'
}
],
plugins: [
cleandir(),
peerDepsExternal({ includeDependencies: true }),
resolve(),
typescript({
tsconfig: './tsconfig.json',
noEmitOnError: true,
declaration: true,
declarationDir: 'dist',
include: [ '**/*.ts', '**/*.tsx' ],
outDir: 'dist',
exclude: [
'**/*.test.tsx',
'**/*.test.ts',
'**/*.stories.ts',
'**/*.stories.tsx'
]
}),
json()
]
};
And the error I'm seeing looks like:
[!] RollupError: src/CoreReduxTypes.ts (2:7): Expected ',', got 'Action' (Note that you need plugins to import files that are not JavaScript)
src/CoreReduxTypes.ts (2:7)
1: import {
2: type Action,
^
3: type Dispatch,
4: type Middleware,
at Object.getRollupError (/project/client-utilities/node_modules/rollup/dist/shared/parseAst.js:285:41)
at ParseError.initialise (/project/client-utilities/node_modules/rollup/dist/shared/rollup.js:15580:40)
I've seen an error like this before where a *.ts is included in the imported tsconfig.json but not matched in the include passed to the @rollup/plugin-typescript plugin.
Has anyone seen anything like this before?
If so, what steps did you take to resolve? Any help greatly appreciated!