Giter Site home page Giter Site logo

Aot typeerror about ng2-nouislider HOT 18 CLOSED

tb avatar tb commented on August 16, 2024 4
Aot typeerror

from ng2-nouislider.

Comments (18)

tb avatar tb commented on August 16, 2024 6

@MetaVurt Thanks! I published that change as 1.5.2 see 8f03307

from ng2-nouislider.

stephanrauh avatar stephanrauh commented on August 16, 2024 3

A radical workaround is to use replace the library by the file https://github.com/tb/ng2-nouislider/blob/master/src/nouislider.ts. Just copy it somewhere in your source folder and remove the library from the packages.json until the bug has been fixed.

from ng2-nouislider.

rerickson1 avatar rerickson1 commented on August 16, 2024 2

I can confirm

Adding "@ngtools/webpack": "1.2.3" to package.json resolved this issue for me.

I don't think this issue should be closed though. We shouldn't have to add this to our package.json. The dependencies for this package (ng2-nouislider) should be setup correctly to solve this issue.

from ng2-nouislider.

weo3dev avatar weo3dev commented on August 16, 2024 1

Can confirm. Am getting same error with simple ng build --prod. Error specifically points to ng2-nouislider's ts.

ERROR in ./~/ng2-nouislider/src/nouislider.ts
Module build failed: TypeError: Cannot read property 'text' of undefined

I'm digging into it right now, and I will add my two cents' worth that yes, when releasing, either things like this should be clarified in the instructions on a readme, or should be resolved within the package itself. I recognize that the landscape is still changing rapidly these days, but it is worth it to communicate upfront that a little housekeeping may be necessary to get a particular directive to work in any one person's production environment.

I will post any updates if I find a working case that isn't a hack.

from ng2-nouislider.

weo3dev avatar weo3dev commented on August 16, 2024 1

Rock n roll, @tb, glad to be of help!

from ng2-nouislider.

rerickson1 avatar rerickson1 commented on August 16, 2024

I see the same issue

from ng2-nouislider.

kkotak avatar kkotak commented on August 16, 2024

Same here. +1

from ng2-nouislider.

kkotak avatar kkotak commented on August 16, 2024

Adding "@ngtools/webpack": "1.2.3" to package.json resolved this issue for me.

from ng2-nouislider.

stephanrauh avatar stephanrauh commented on August 16, 2024

Same here. +1

from ng2-nouislider.

stephanrauh avatar stephanrauh commented on August 16, 2024

@tb Maybe the discussion in this tickets helps you to solve bug bug. Among other things, it mentions what causes this (or a similar) bug: angular/angular-cli#4072

from ng2-nouislider.

rsquared24 avatar rsquared24 commented on August 16, 2024

@rerickson1 @kkotak did you add @ngtools/webpack as a dev dependency? It still throws the same error for me :(

@angular/[email protected]
@ngtools/[email protected]
[email protected]

from ng2-nouislider.

kkotak avatar kkotak commented on August 16, 2024

@rsquared-digital, Yes I have under dev. I also have "@angular/cli": "1.0.0-beta.30", which might also be relevant.

from ng2-nouislider.

rerickson1 avatar rerickson1 commented on August 16, 2024

@rsquared-digital I have it under dev as well. Here is my package.json content:
"dependencies": {
"@angular/common": "2.4.3",
"@angular/compiler": "2.4.3",
"@angular/core": "2.4.3",
"@angular/forms": "2.4.3",
"@angular/http": "2.4.3",
"@angular/platform-browser": "2.4.3",
"@angular/platform-browser-dynamic": "2.4.3",
"@angular/router": "3.4.3",
"angular-in-memory-web-api": "^0.2.4",
"angular2-jwt": "^0.1.27",
"angular2-ui-switch": "^1.2.0",
"bootstrap": "~3.3.7",
"core-js": "^2.4.1",
"jquery": "~3.1.1",
"jsen": "^0.6.4",
"jsrsasign": "^6.2.3",
"ng2-bootstrap": "^1.3.1",
"ng2-nouislider": "^1.5.0",
"nouislider": "^9.2.0",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@angular/cli": "1.0.0-beta.30",
"@angular/compiler-cli": "2.4.3",
"@ngtools/webpack": "1.2.3",
"@types/jasmine": "2.5.38",
"@types/jsen": "0.0.18",
"@types/node": "^6.0.42",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "~4.0.13",
"ts-node": "1.2.1",
"tslint": "^4.3.0",
"typescript": "~2.0.3"
}

from ng2-nouislider.

kkotak avatar kkotak commented on August 16, 2024

Check your typescript version. Mine is 2.1.5. Other than that, I'm not sure.

from ng2-nouislider.

sabrio avatar sabrio commented on August 16, 2024

I am having the same issue while building my project in production mode ng build --prod and after removing the ng2-nouislider everything works fine.
Typescript: 2.1.6 or 2.2.1
@angular/cli: 1.0.0-rc.0
@ngtools/webpack: 1.2.5 or 1.2.11

Any work around please, I need to deploy production version??

from ng2-nouislider.

sabrio avatar sabrio commented on August 16, 2024

@stephanrauh thanks, it works. Confirmed

from ng2-nouislider.

weo3dev avatar weo3dev commented on August 16, 2024

SOLVED

Per @emoralesb05 in this conversation, which is a closed, open again conversation, what seems to be the issue are source ts files being included in the delivered package, thereby tripping up the build script(s) of angular-cli.

I literally went into

node_modules/ng2-nouislider/src/

and removed

nouislider.ts

I am now able to:

npm build --prod
npm build --prod --aot

My current setup is the following:

@angular/cli: 1.0.0-rc.0
node: 7.4.0
os: darwin x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-rc.0
@angular/compiler-cli: 2.4.8

I upgraded my build following the Upgrade Steps from the Angular-CLI team, listed here.

I do not apparently have any reason to cut/paste a reference to @ngtools/webpack in package.json, as listed here.

Here are my dependencies and dev dependencies, for anyone's reference:

  "dependencies": {
    "@angular/common": "^2.4.8",
    "@angular/compiler": "^2.4.8",
    "@angular/core": "^2.4.8",
    "@angular/forms": "^2.4.8",
    "@angular/http": "^2.4.8",
    "@angular/material": "^2.0.0-beta.2",
    "@angular/platform-browser": "^2.4.8",
    "@angular/platform-browser-dynamic": "^2.4.8",
    "@angular/router": "^3.4.8",
    "core-js": "^2.4.1",
    "ng2-nouislider": "^1.5.1",
    "nouislider": "^9.2.0",
    "rxjs": "^5.2.0",
    "zone.js": "^0.7.7"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0-rc.0",
    "@angular/compiler-cli": "^2.4.8",
    "@types/jasmine": "2.5.43",
    "@types/node": "~7.0.5",
    "codelyzer": "~3.0.0-beta.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.5.0",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.3",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.1",
    "ts-node": "~2.1.0",
    "tslint": "~4.4.2",
    "typescript": "~2.2.1"
  }

And in the app itself, I only use the following -
app.module.ts

import { NouisliderModule } from 'ng2-nouislider';
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    ReactiveFormsModule,
    NouisliderModule,
    MaterialModule.forRoot(),
    RouterModule.forRoot(ROUTES)
  ],

I use the ui slider in a child component, with no other import code being needed.

I truly hope this helps everyone get back on track.

from ng2-nouislider.

bradrisse avatar bradrisse commented on August 16, 2024

I can confirm --prod build is now working. Thanks!

from ng2-nouislider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.