Transpiling deps from node_modules
Closed this issue · 6 comments
Is it possible to transpile code from separate package as our dependency?
That separate package contains untranspiled typescript code and it should go to the bundle along with our TS code.
P.S. "main"
section from package.json
of separate package points to .ts
file.
Should be possible, you might have to make sure include/exclude in both tsconfig and in plugin options in rollup config capture that path I think.
How does it behave now?
For now and by default when rollup is meeting the .ts file outside of current module he throws an error of unknown syntax, like
[!] Error: The keyword 'interface' is reserved (Note that you need plugins to import files that are not JavaScript)
I'm going to try your suggestion
Yep, I see what it does. I'll look into it, thanks.
You can probably workaround by using rollup-plugin-babel.
Just looked at it again, and it seems all you need to do is allow plugin to touch js files: include: ["*.ts+(|x)", "**/*.ts+(|x)", "**/*.js"]
.
Currently only ts and tsx files are touched, even though you set allowJS: true
in tsconfig and typescript would normally process js files in this case.
I'd add js files automatically if allowJs is set to true, but that brings build time from 6 seconds to 2 mins for me, so it's an option one should turn on carefully :). See allowjs
branch if you want to check it out.