jkuri / angular-rollup-starter

Angular2 & Rollup.js including AoT and Universal Prerendering
MIT License
32 stars 9 forks source link

How to include 3rd party libs #6

Open Adam-Michalski opened 7 years ago

Adam-Michalski commented 7 years ago

How to include 3rd party libs like ng2-translate, ng2-material and others? After adding module to vendor.ts and build i have errors. Inside your files i added: vendor.ts

import {TranslateModule} from 'ng2-translate/ng2-translate';
export default {
   TranslateModule,
}

build.ts

globals:{
'ng2-translate/ng2-translate': 'vendor.TranslateModule'
}
external: [
        'ng2-translate/ng2-translate'
      ]

I fixed it import * as _angular_translate from 'ng2-translate/ng2-translate';

default as _angular_translate,

build globals as 'ng2-translate/ng2-translate': 'vendor._angular_translate' and external 'ng2-translate/ng2-translate'

But I can't configure ng2-auto-complete the same way and I don't know why

with npm run serve it is working but after this configuration I have this error with npm run roll compile error: Error: Could not resolve '../../../src/translate.service'

marcoturi commented 7 years ago

To find examples on how to import 3rd party libs with rollup see here and here

Shyam-Chen commented 7 years ago

https://github.com/rollup/rollup-plugin-inject