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: TypeError: tscc is not a function #771

Open
AlexLein opened this issue Oct 26, 2022 · 1 comment
Open

Rollup plugin: TypeError: tscc is not a function #771

AlexLein opened this issue Oct 26, 2022 · 1 comment

Comments

@AlexLein
Copy link

Hi, please excuse my ignorance,

I am trying to get tscc working by following the Getting Started guide in README.md, but I am running into an issue with the second phase (rollup). I have duplicated the folder structure from the example (mostly, I am building a library, not an Angular app). I am also using TypeScript instead of JavaScript.

my_project
├─package.json
├─rollup.config.ts
├─tscc.spec.json
├─tsconfig.json
└─src
    ├─foo.ts
    └─main.ts

I installed using npm instead of yarn, and if I execute tscc the project builds. I also removed the typescript() from the plugins in my rollup.config.ts file since it was not in the imports. And if I add an import for it, it has no effect.

>tscc
TSCC: Module option is set. tsickle converts TypeScript modules to Closure modulesvia CommonJS internally, so it will be overridden to "commonjs".
TSCC: tsickle uses a custom tslib optimized for closure compiler. importHelpers flag is set.
√ Closure Compiler 00:01
TSCC: Compilation success.

But when I get to also using rollup, it doesn't work and throws an error that tscc is not a command?

>rollup -c rollup.config.ts --configPlugin @rollup/plugin-typescript
[!] TypeError: tscc is not a function
TypeError: tscc is not a function
    at file:///x:/my_project/rollup.config-1666818813167.mjs:11:9
    at ModuleJob.run (node:internal/modules/esm/module_job:197:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:341:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
    at async loadConfigFromWrittenFile (C:\Users\alein\AppData\Roaming\npm\node_modules\rollup\dist\shared\loadConfigFile.js:487:17)
    at async getConfigFileExport (C:\Users\alein\AppData\Roaming\npm\node_modules\rollup\dist\shared\loadConfigFile.js:410:20)
    at async Object.loadConfigFile (C:\Users\alein\AppData\Roaming\npm\node_modules\rollup\dist\shared\loadConfigFile.js:391:59)
    at async getConfigs (C:\Users\alein\AppData\Roaming\npm\node_modules\rollup\dist\bin\rollup:1680:39)
    at async runRollup (C:\Users\alein\AppData\Roaming\npm\node_modules\rollup\dist\bin\rollup:1657:43)

I have installed rollup, the rollup typescript plugin, tscc, the rollup plugin, all of them both locally and globally. I am hoping that I am missing something obvious, but this has been driving me nuts for two days.

Any idea what I am doing wrong, or is this really a bug?

@smcjones
Copy link

Maybe a rollup thing, but I got around it with tscc.default() instead of tscc()

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