Closed lucaritossa closed 6 years ago
I don't get this error message. It says in the file the file itself is missing.
Unfortunately I'm not actively using this library and don't get all this errors. To use an established package format was not an option at the time of writing this library because there was nothing established in angular v2 and v4. It begins to annoying me that we get errors with every update of a package while the interpretation of JS is still valid in all browsers.
Maybe for version 3 I will use the suggested package format. But for know I just want to fix the problem.
Do you run ng build
or ng serve
?
Here is the output from my angular-translator-demo app:
$ node_modules/.bin/ng serve
@angular/compiler-cli@5.0.1 requires typescript@'>=2.4.2 <2.5.0' but 2.6.2 was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.
Please run the following command to install a compatible version of TypeScript.
npm install typescript@'>=2.4.2 <2.5.0'
To disable this warning run "ng set warnings.typescriptMismatch=false".
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-01-16T05:57:30.359Z
Hash: fc4e6224feb9c60e9f12
Time: 4986ms
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 52.6 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 609 kB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 34.4 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 8.68 MB [initial] [rendered]
webpack: Compiled successfully.
So a typical "It works on my machine problem"...
I just updated angular cli to 1.6.4 - same result.
Thank you for your test!
I'm facing this problem only when running ng build --prod
(the --prod flag enables the AOT and other optimization stuff)
Versions used:
Oh angular-translator 2.4.1 - I forgot about this release :smile:
But sorry: same result - just the warning about mismatching typescript version. I have no idea where this could come from.
So if you don't get the error running ng build --prod
I will try to test it on another machine... maybe it doesn't work only on my current machine...
Today I saw that my IDE wants to import from angular-translator/src/Translator
instead of angular-translator
.. Maybe this is causing the problem?
@lucaritossa could you solve your problem? If not please attach a minimal version that produces this error (or create a public repository with a minimal version). thanks in advance.
@tflori I will prepare a minimal version to reproduce this issue and will provide to you.
Ok, I was able to reproduce the issue with this ng -v
Here it is the attached minimal reproducible version angular-translator-aot-build-error.zip
To see the error run: npm run build
It is very important to have the typescript version 2.6.2 so I forced package.json to get it.
I also found a workaround modifiying tsconfig.app.json. I added this "include":
"include": [
"../src/**/*.ts",
"../node_modules/angular-translator/src/**/*.ts"
]
It's for sure a bug from ngc or tsc. Removing the .ts files solves the problem because the files are already compiled. Once there was a reason why I included them in the npm package - of course: now I cant remember. They should not be needed because it's already transpiled to js..
angular-translator 2.4.2 should solve the problem. lets hope there will not come regressions :smile:
I've just tried to upgrade my package.json (devDependencies) to typescript to v2.6.2 but building in AOT I receive this error:
This type of error continue for the other files like TranslatePipe, Json, Translator etc
The error suggest you have to package the library using Angular Package Format
I'm also using angular v5.2.0