tinymce / tinymce-angular

Official TinyMCE Angular Component
MIT License
324 stars 93 forks source link

v3.6.0 wont build with --prod --build-optimizer --aot #173

Closed ShaneMcGowan closed 2 years ago

ShaneMcGowan commented 4 years ago

What is the current behavior? When building an angular app with ng build --prod --build-optimizer --aot with v3.6.0 I get the following error

ERROR in ./node_modules/@tinymce/tinymce-angular/fesm5/tinymce-tinymce-angular.js
Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js):
TypeError: Cannot read property 'kind' of undefined
    at isAngularDecoratorMetadataExpression (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:265:35)
    at checkNodeForDecorators (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:77:21)
    at visitNodes (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16144:30)
    at Object.forEachChild (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16370:24)
    at checkNodeForDecorators (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16135:24)
    at Object.forEachChild (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16265:21)
    at checkNodeForDecorators (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16135:24)
    at Object.forEachChild (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16322:24)
    at checkNodeForDecorators (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16135:24)
    at Object.forEachChild (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16333:24)
    at checkNodeForDecorators (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16135:24)
    at Object.forEachChild (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16229:21)
    at checkNodeForDecorators (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNodes (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16144:30)
    at Object.forEachChild (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16379:24)
    at checkNodeForDecorators (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNode (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16135:24)
    at Object.forEachChild (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16377:21)
    at checkNodeForDecorators (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31)
    at visitNodes (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16144:30)
    at Object.forEachChild (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16372:24)
    at transformer (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:63:16)
    at /home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:1390:86
    at reduceLeft (/home/shane/app/frontend/src/main/frontend/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:1102:30)

What is the expected behavior? For the build to succeed

Which versions of TinyMCE/TinyMCE-Angular, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or TinyMCE-Angular? Issue occurring in v3.6.0 Issue not occurring in v3.5.0

jscasca commented 4 years ago

Hi @ShaneMcGowan

I tried building with those parameters using Angular 8.3.26 and I can't replicate that error. What Angular version are you using? What Typescript version are you using?

Have you tried recompiling or removing the package-lock, node_modules and reinstalling before building?

OSorokin commented 4 years ago

The same error. angular version 7.2.15 typescript 3.2.4

ShaneMcGowan commented 4 years ago

Angular CLI: 7.3.9 Node: 10.21.0 OS: linux x64 Angular: 7.2.16 ... animations, common, compiler, compiler-cli, core, forms ... http, platform-browser, platform-browser-dynamic ... platform-server, router

Package Version

@angular-devkit/architect 0.13.9 @angular-devkit/build-angular 0.13.9 @angular-devkit/build-optimizer 0.13.9 @angular-devkit/build-webpack 0.13.9 @angular-devkit/core 7.3.9 @angular-devkit/schematics 7.3.9 @angular/cli 7.3.9 @ngtools/webpack 7.3.9 @schematics/angular 7.3.9 @schematics/update 0.13.9 rxjs 6.5.4 typescript 3.1.6 webpack 4.29.0

stevekanter commented 4 years ago

@jscasca any additional thoughts here?

@ShaneMcGowan have you gotten this working? Experiencing the same issues as you

stevekanter commented 4 years ago

Has anyone gotten this working?

ShaneMcGowan commented 4 years ago

Has anyone gotten this working? Sorry for the delay in replying to your earlier message!

Downgrading to v3.5.0 worked for us as a workaround and the editor is working fine. You can do this by changing the version to "3.5.0" in your package.json file and running npm install

tinydylan commented 3 years ago

Hi all.

Are you able to provide a simple sample app that demonstrates the issue - as a zip file or github repo perhaps? Sorry, we're unable to reproduce it so far - we must be doing something slightly different.

Many thanks.

brunoricardore commented 3 years ago

Hi, @tinydylan It seems like something with the typescript version, here in my project I'm using Angular 7 + typescript 3.2.4

minhtam-nguyennhat commented 3 years ago

Have we got any update for this?

exalate-issue-sync[bot] commented 3 years ago

Ref: INT-2612

shilunl commented 2 years ago

估计是@angular-devkit/build-angular 版本号问题 , “@angular-devkit/build-angular": "~0.803.10" ,我用这个没有问题

jscasca commented 2 years ago

I'm closing this as we could not replicate the described behaviour and since the author was able to work around the issue. Happy to re-open if a sample repo is provided

yazharasu commented 2 years ago

Getting same error.

tinymce 5.10.5 tinymce-angular 3.6 Angular 7.2.0 node 12.18.3 angular-devkit/build-angular 0.13.9 angular/cli 7.3.8 typescript 3.2.2

Anyone got this working?