Alberplz / angular2-color-picker

Angular 2 Color Picker Directive, no dependences required.
MIT License
185 stars 82 forks source link

Unexpected value 'ColorPickerModule' imported by the module #66

Open fahad-nxvt opened 7 years ago

fahad-nxvt commented 7 years ago

Updated angular to 2.3.0 and start getting this error

Unexpected value 'ColorPickerModule' imported by the module

Anyone knows how to fix this?

curlyfro commented 7 years ago

i just upgraded from angular 2.1 to 2.3 and i'm getting the same error.

curlyfro commented 7 years ago

fixed. i npm uninstalled then re-installed the package and that fixed it.

jonohrt commented 7 years ago

I also just updated from angular 2.1 to 2.3 and I'm also getting this error. I uninstalled and re-installed the package and the error persists. Deleted node_modules and re-installed and still I'm still getting the error. Any idea?

fahad-nxvt commented 7 years ago

I uninstalled and installed it many times but no luck.

ghost commented 7 years ago

I have the same error ... uninstalling / reinstalling does not help

fahad-nxvt commented 7 years ago

any luck anyone?

lucahost commented 7 years ago

i get the error "Unexpected Value 'e' in Modules..." using Angular2, TypeScript with WebPack. Installed colorpicker with npm

garethlewis commented 7 years ago

You're getting that error as the color picker is tied to Angular 2.1.0, is there was a change such as 2.1.1 onwards it would work, but the package.json has Angular referenced as ~2.1.0, so it will not use 2.2.0 or 2.3.0. If you're using SystemJS, you will not notice this problem, as it will download the version of Angular 2 needed for the color picker and also the version of Angular 2 for your app. The problem occurs when using Webpack. It is trying to consolidate the code into a single file, usually vendor.js, and this ends up being incorrect, as the differences between Angular 2.1.0 and Angular 2.2.0 will throw the packer off.

ghost commented 7 years ago

Hm.. any workaround for that? (As I assume it will always happen when my angular version is ahead of color-picker's angulas version?)

garethlewis commented 7 years ago

The only way I would recommend fixing this is to fork the repository and build from source yourself into a package that you can use. Then change the referenced version of angular to whichever version you need to use.

The pros: You are in charge of the Angular version used. The cons: Your fork will not contain any new changes made to the main repo. You will have to switch to that branch and merge in those changes to your fork. As long as your fork isn't too old, you should not have any problems. But if you start making changes to any of the files, you run the usual risk of merge conflicts which may be difficult to resolve without prior knowledge.

BrainCrumbz commented 7 years ago

Hello all. Working in our team, we now have a modified version of this library that seems to be working in AOT-enabled build. That should address this present issue, as well as #40, #50, #61, #64.

@Alberplz would you consider discussing & eventually accepting a PR on such issue? I'm asking it as there are already a couple of our PRs that were either closed unmerged or left open.

Tnx

raducostea commented 7 years ago

@BrainCrumbz Where can i find your build?

BrainCrumbz commented 7 years ago

Just pushed, you can find it at ng2-aot-color-picker-sample together with some instructions. HTH

sconix commented 7 years ago

I have also a working AOT version and I plan to make PR as soon as I fix the example apps. I can post url to the github repo as soon as I have made the PR, the repo will have a npm-package branch that can be used to install the aot version through npm.

fospitia commented 7 years ago

Thanks @sconix but in the npm-package branch the .js files aren't compiled, are the same .ts files

sconix commented 7 years ago

They are compiled, I can't see how they could be the same as ts files. The js files are produced by the ngc compiler. Or do you mean that they are not minimized which they should not be, that is task of the application compilation to pack the libraries.

And we use that branch ourselves in our product so its definitely works :)

fospitia commented 7 years ago

I use webpack and this commit work for me git://github.com/zefoy/angular2-color-picker.git#cc12b8b516ce85f237ba62da4f7b75f731476ada

sconix commented 7 years ago

We use angular-cli in our project which uses webpack and the npm-package branch works nicely. There is also aot-fixes branch where you have the exact same build files as in npm-package and the both systemjs and webpack example apps work nicely when using the the build library from npm-package branch.

Hmm so thats the second last commit that is working for you, I will check if for some reason we don't have the latest commit in use and that if I somehow messed up the latest commit. All I know that I did test with the latest from aot-fixes branch and just copied the build files from there, but who knows if I managed to mess up that process.

Although I think the only difference between the last commit was that I removed the unnecessery ts files from the lib file, so are you sure that you have setup your project correctly and are using the build js files and not the ts files?

BearandYoon commented 7 years ago

I am using angular-cli and angular2-color-picker but it is not working for me.

"dependencies": { "@angular/common": "^2.3.1", "@angular/compiler": "^2.3.1", "@angular/core": "^2.4.1", "@angular/forms": "^2.3.1", "@angular/http": "^2.3.1", "@angular/platform-browser": "^2.3.1", "@angular/platform-browser-dynamic": "^2.3.1", "@angular/router": "^3.3.1", "@types/socket.io-client": "^1.4.29", "angular2-color-picker": "^1.3.0", "chart.js": "2.3.0", "core-js": "^2.4.1", "moment": "2.15.2", "ng2-bootstrap": "^1.1.16", "ng2-charts": "1.4.1", "rxjs": "^5.0.0-rc.1", "ts-helpers": "^1.1.1", "zone.js": "^0.6.26" },

It is working for you?

sconix commented 7 years ago

There is a working version which can be installed from: git://github.com/zefoy/angular2-color-picker.git#npm-package

The released version is broken since angular-cli made the change that libs need to be AOT compatible. I have made a pull request and tried to contact the developer to get new release out but so far no luck.

BearandYoon commented 7 years ago

@sconix It works very well. Thanks.

zskhan commented 7 years ago

Please refer this: https://github.com/Alberplz/angular2-color-picker/issues/82