Check out this GitHub repository for a sample project that showcases the issue.
Here is the content of my package.json:
{
"name": "rollup-ts-deps",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Mike Hogan",
"license": "ISC",
"devDependencies": {
"@rollup/plugin-typescript": "^8.2.0",
"rollup": "^2.41.0",
"typescript": "^4.2.3"
},
"dependencies": {
"@http4t/core": "0.0.121"
}
}
Additionally, here's the content of the rollup.config.js file:
import typescript from '@rollup/plugin-typescript';
export default {
input: 'src/index.ts',
output: {
file: 'lib/index.js',
format: 'cjs'
},
plugins: [
typescript()
]
};
The src/index.ts file contains the following code snippet:
import {post} from "@http4t/core/requests";
console.log(post)
Executing npx rollup -c
results in the error message below:
[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
node_modules/@http4t/core/requests.ts (5:30)
3: import {Authority, Uri, UriLike} from "./uri";
4:
5: export function request(method: Method, uri: UriLike, body?: HttpBody, ...headers: Header[]): HttpRequest {
I'm looking for guidance on configuring Rollup to handle dependencies that are Typescript files. Any suggestions?