I was using ng2-translate with
import { TranslateService } from 'ng2-translate'
and now the rollup complains with
ng2-translate.js does not export TranslateService
It seems rollup (or rollup-plugin-commonjs) doesn't recognize the following commonjs export which is compiled from export * from "./src/translate.service"
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require("./src/translate.service"));
...
After changing the import like this the error disappears.
import { TranslateService } from 'ng2-translate/src/translate.service'
I'm new to rollup so don't know if it's the correct way, or is there any options to tell rollup to recognize the combined export?
This is one library that we are having trouble with.
You can import it like this:
import ng2Translate from 'ng2-translate`
That will get you the default export, but that is lacking many of the things one needs to work with the lib. The solution is to ask the developer to public es5 code with 2015 module syntax, or change their default export to contain everything we need.
CC: @jgw96
Thanks,
Dan
ng2-translate released version 3.0.0 with es2015 syntax and it's working now, thanks.
w00t! That's great news @itryan! I'm going to close this. Have a great weekend!
Thanks,
Dan
Most helpful comment
ng2-translate released version 3.0.0 with es2015 syntax and it's working now, thanks.