rnadler / ng2-password-strength-bar

Angular 2/4/5 Password Strength Bar
http://bobonmedicaldevicesoftware.com/blog/2016/12/09/publishing-an-angular-2-component-npm-package/
MIT License
20 stars 17 forks source link

PasswordStrengthBarModule' is not exported by node_modules\ng2-password-strength-bar\index.js #10

Closed n4uoase closed 7 years ago

n4uoase commented 7 years ago

After compiling my app with AOT I'm going through the process of tree-shakin my bundle. But when I start node_modules/.bin/rollup -c rollup-config.js after a few seconds the systems quits with the following error message:

� 'PasswordStrengthBarModule' is not exported by node_modules\ng2-password-strength-bar\index.js https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module src\app\app.module.js (58:9)

Any ideas how to fix this? Thanks in advance. OASE

rnadler commented 7 years ago

I've never used rollup, but maybe it doesn't like

exports.PasswordStrengthBarModule = require('./lib/passwordStrengthBar.module').PasswordStrengthBarModule;

and you need to use Custom named exports?

n4uoase commented 7 years ago

Hi @rnadler,

to fix this problimt while rolling-up the project I had to adopt the rollup-config.js section within plugins. Had to add the following lines in the plugins array [] which looks like this: [don't worry about the other modules, they lead to issues too :-)]

plugins: [
    nodeResolve({jsnext: true, module: true}),
    commonjs({
          include: [
              'node_modules/**'
          ],
      namedExports: {
        'node_modules/angular-modal-gallery/dist/bundles/angular-modal-gallery.umd.js': ['ModalGalleryModule'],
        'node_modules/angular2-logger/core.js': ['Logger', 'Options'],
        'node_modules/angular2-dropzone-wrapper/dist/index.js' : ['DropzoneModule'],
        'node_modules/angular2-datatable/lib/DataTableModule.js' : ['DataTableModule'],
        'node_modules/angular-modal-gallery/dist/bundles/angular-modal-gallery.umd.js' : ['Image','ModalGalleryModule']
          }
    }),
    uglify()
  ]