angular-rollup-starter icon indicating copy to clipboard operation
angular-rollup-starter copied to clipboard

How to include 3rd party libs

Open Adam-Michalski opened this issue 9 years ago • 2 comments

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'

Adam-Michalski avatar Oct 18 '16 14:10 Adam-Michalski

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

marcoturi avatar Oct 20 '16 12:10 marcoturi

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

Shyam-Chen avatar Nov 05 '16 05:11 Shyam-Chen