Categories
Mastering Development

How to configure stencil so that generated ts file doesnt come with double quotes

Right now whenever I ran command stencil build –docs, it will generate components.d.ts with below content /* eslint-disable */ /* tslint:disable */ /** * This is an autogenerated file created by the Stencil compiler. * It contains typing information for all components that exist in this project. */ import { HTMLStencilElement, JSXBase } from "@stencil/core/internal"; […]

Categories
Mastering Development

webpack4: window/document is not defined

I m starting out with webpack and I ran into a problem while running a build which was initially "document" is defined. I followed this post about that error but it didn’t fix itwebpack 4 error, I tried wrapping the whole file in window.addEventListener(‘load’, function(){ //my code doing async/fetch }) that didn’t work too and […]

Categories
Mastering Development

Promise polyfill does not work in FireFox and IE11 when added via Webpack babel-loader

I got hit with below peculiar issue on promise polyfill that should be added by Babel’s preset-env for browser compatibility. I have a Foo.ts file which uses the async/await syntax to handle promises. After being processed by babel-loader, bundled and started by Webpack dev server, the containing React web application runs successfully in Chrome, Safari, […]

Categories
Mastering Development

How to transpile a node_module with webpack in a web worker?

I am trying to include a node module (primitive-ellipsoid) in my wepback project. The module is not transpiled to es5 so throws an error when used in the browser: Uncaught Error: Module parse failed: /Users/kevzettler/code/crashgiants/node_modules/primitive-ellipsoid/index.js Unexpected token (8:4) You may need an appropriate loader to handle this file type. | // Default to an oblate […]

Categories
Mastering Development

How to enable @ experimentalDecorators in next.config.js or babelrc

Hi if someone would help me, I wanna use @Decorators on my nextjs app, but I get the following error. Hope someone knows what Im doin wrong Error message: Syntax error: Support for the experimental syntax ‘decorators-legacy’ isn’t currently enabled: I’m trying to use typeorm / type-graphql to generate my backend in an app subfolder. […]

Categories
Mastering Development

Webpack – import const from .d.ts file not working – Can’t resolve ‘@nuvolo/servicenow-types/server/GlideRecord’

I’m doing this: import { GlideRecord } from "@nuvolo/servicenow-types/server/GlideRecord"; I have a file node_modules/@nuvolo/servicenow-types/server/GlideRecord.d.ts It contains: … type GlideRecordConstructor = { new <T>(table: string): GlideRecord<T> }; type GlideRecord<T> = GlideRecordBase<T> & T; declare const GlideRecord: GlideRecordConstructor; export { GlideRecord }; If I run tsc it works, no errors Webpack says: Module not found: Error: Can’t […]

Categories
Mastering Development

Video JS in Angular 9 – live video – ‘Can’t resolve videojs’ problem?

I am struggling to get the videojs to work in my angular 9 app. I have viewed all the exisitng stackoverflow posts, applied their solution, looked at different blog posts and github for issues with video js but I still have the ‘Can’t resolve videojs’ problem. I would like it to work in that an […]

Categories
Mastering Development

System limit for number of file watchers reached

I try to run my project on the ubuntu server. command: npm run production it calls webpack-dev-server –config webpack.prod.js –mode production –inline –progress After it builds I get a lot of issues: Error from chokidar (/root/galyan/client/node_modules/@material-ui/icons): Error: ENOSPC: System limit for number of file watchers reached, watch ‘/root/galyan/client/node_modules/@material-ui/icons/index.d.ts’ Error from chokidar (/root/galyan/client/node_modules/@material-ui/icons): Error: ENOSPC: System […]

Categories
Mastering Development

svelte 3 typescript: Unexpected tokensvelte(parse-error)

I’m new to svelte and I would like to try it with typescript by following the official guideline. I have generated the project and haven’t done any change to my code. But I’m getting an (linting?) error from vscode editor (generated file App.svelte): Any help would be greatly appreciated. vscode: Version: 1.47.3, vscode slvelte (official […]

Categories
Mastering Development

Script Path for CSS and Bundle is a bit off after WebPack Creates index.html

For some reason, webpack is trying to append client to the href of the script tags for my CSS and bundle. The problem with this is that it’s wrong. And I don’t know how to tell it to trim that part off. Lets start with how I’m serving my assets. My ExpressJS server sets the […]