Closed frankdavidcorona closed 4 years ago
Could you please:
cases-year.component.ts
?If you compile your project with TypeScript and then run node on the compiled cases-year.component.ts
file (e.g. node dist/app/modules/performance/containers/cases-year/cases-year.component.js
), do you get the same error?
@smcenlly In this project we're using a package for make a cache from prev API request called: ngx-cacheable. I'm almost sure that this package it's the issue due to adding comments to the usage this error start to dissapear from different points. Let me explain better: If I removed the usage of this implementation from: ./src/app/core/services/employee.service.ts:59 then the error not notify anymore from this service and jump to another service used in the component an that use this same approach.
This is an example of usage of this package in one of the services that use this component that cuase error:
import { Cacheable, CacheBuster, GlobalCacheConfig } from 'ngx-cacheable';
import { DOMStorageStrategy } from 'ngx-cacheable/common/DOMStorageStrategy';
GlobalCacheConfig.storageStrategy = DOMStorageStrategy;
const cacheBuster$ = new Subject<void>();
// define standard configuration for cache
const cacheConfig = {
cacheBusterObserver: cacheBuster$,
...iCacheConfig,
};
@Cacheable({ ...cacheConfig })
getProviders(): Observable<any> {
return this.http
.post(`${this.baseUrl}/providers`, {})
.pipe(map(getData));
}
In another project, when we are not using this package, Quokka return this error:
Quokka 'schedule.component.ts' (node: v12.18.3, TypeScript: v3.5.3)
Unexpected token } in JSON at position 1188
at parse ./node_modules/tsconfig/src/tsconfig.ts:195
at readFileSync ./node_modules/tsconfig/src/tsconfig.ts:181
at Object.loadSync ./node_modules/tsconfig/src/tsconfig.ts:151
at readConfig ./node_modules/ts-node/src/index.ts:425
at Object.register ./node_modules/ts-node/src/index.ts:189
Maybe we've missing some config for the package?
This is an example usage of this package in one of the services that use this component that causes an error:
We have investigated the ng-cacheable
library and can see that the DOMStorageStrategy.ts
class that you are using requires some browser-specific runtime components that are not available using Quokka's default runtime. As per our docs, Quokka runs your code in node.js
(e.g. using ts-node ./src/app/core/services/employee.service.ts
). The ngx-cacheable/common/DOMStorageStrategy.ts
is designed to run in a browser environment (not node.js
) and relies on the localStorage
browser object, which is not available in node
. Quokka does allow for a browser-like runtime by configuring JSDOM that adds polyfills for various browser runtime environment options (including localStorage
). You may configure JSDOM
with Quokka as per our docs to try fix your problem.
In another project, when we are not using this package, Quokka return this error:
It looks like there may be an issue with your tsconfig.json
file as this error is occurring when parsing your tsconfig file (see source code). Does your project compile with TypeScript?
For us to assist you further, please provide us with:
tsconfig.json
for this project.If you continue to have problems, please try compiling your project with TypeScript and then run node on the compiled code to better determine why your code is not working in Quokka. If you need further assistance, please provide us with a sample repo that includes your package.json
, tsconfig.json
and code sample that is not working for you so we can replicate your problem ourselves.
Closing this issue (assuming our previous comment fixes your problem).
If you're still having problems, please reply and we can re-open the issue.
Issue description or question
I already bougth the Pro version and I can't start the compiler in my current project getting the explained above error message. Also already added this config in my
package.json
Also tried adding this extra config:
but the error persists
Quokka.js Console Output
Code editor version
Visual Studio Code v1.48.2
OS name and version
Linux