Categories
Mastering Development

Why my Dockerized LoopBack4 App runs unsuccessfully and receives message “ConnectionError: Failed to lookup instance on”?

I created a LoopBack 4 App to implement CRUD operations on User data model following the LoopBack 4 tutorial and the app works fine in VSCode and with Dockerization (Linux Container mode). After that I add in basic authentication function base on username and password. The app again works fine in my VSCode but Dockerization […]

Categories
Mastering Development

Why do I need “@babel/plugin-proposal-optional-chaining” in my setup using “@babel/preset-env” and “@babel/preset-typescript”

I have a project using Typescript and @babel/preset-env. Bundling with Webpack fails with this error and the config below. If I un-comment the line, which forces @babel/plugin-proposal-optional-chaining to be included, then compilation works. It also works if I add Safari, Edge or IE 11 to the targets string. Why is that? ERROR in ./src/bla.ts 58:23 […]

Categories
Mastering Development

Webpack / Html-loader removes CSS in minimize mode

Problem I am using Webpack, Html-loaded and EJS in a project to render some HTML. The HTML does contain some embedded CSS: #clawgame-sidebar img { max-height: 196px; } #clawgame-sidebar.clawgame-sidebar-active { <%= (o.sidebarPosition==ET_SidebarPosition.Left? “left: 0px;”: “right: 0px;”)) %> max-width: 100%; } Whenever I run Webpack in production mode / Html-loader with minimized option, the second CSS-statement […]

Categories
Mastering Development

Webpack Unexpected Token / no loader for filetype

I have a plain JavaScript app that could not be build with WebPack. I removed everything until only those lines remain: class MyClass { doStuff = (abc) => { } } The error message I get is the following: ERROR in ./src/js/mapdata.js 2:12 Module parse failed: Unexpected token (2:12) You may need an appropriate loader […]

Categories
Mastering Development

Webpack: Set the path for my assets according to the entry name

Using webpack, I have a multiple page application which works with multiple entries. I have a project tree like this: — webpack.config.js — src/ — first/ — main.ts — helper.ts — main.css — index.html — second/ — main.ts — main.css — index.html — assets/ — myAsset1.png — myAsset2.png — myAsset3.png I wanted something tidy and […]

Categories
Mastering Development

Reconstruct 3D object with OpenCV

I am following the OpenCV camera calibration tutorial https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_calib3d/py_calibration/py_calibration.html to run camera calibration ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, gray.shape[::-1],None,None) What I want to do next is to reconstruction the 3D location of some feature points. The features points are defined in the image space. Here is what I am planning to do: […]

Categories
Mastering Development

Using babel & web pack with react without create-react-app

My goal is to create a simple app and output one js standalone file and one css standalone file without using create-react-app. I have two functional components like const Card = () => { return( <div>test</div> ) } export default Card; My app.js file import ReactDOM from ‘react-dom’; import Card from ‘./Card’; ReactDOM.render(<Card />, document.getElementById(‘root’)); […]

Categories
Mastering Development

Load GLB model with Webpack – Three.js

I’m trying to use Webpack for the first time and I have trouble to add my glb model. My model is ok, used many times and I put in public folder. I dont’ understand console error, any help will be appreciate, thanks. I’m using three.js r116 and Firefox. Safari tell me same error, can’t found […]

Categories
Mastering Development

How can I share a library between my Vue CLI application and existing vanilla JavaScript?

I’m working on a WordPress website that uses the Swiper library, on several pages, as an npm dependency. Included in the website is an embedded Vue CLI 4 app, that I’d also like to add the Swiper library to. Currently, the website has its own webpack config, while the app uses a slightly modified version […]

Categories
Mastering Development

Migrate webpack V3 to V4 on Angular V1 – SyntaxError: Unexpected token I in JSON at position 0 at JSON.parse

I am trying to upgrade an old project that uses Angular V1. I upgraded babel, webpack, and JQUERY. JQUERY was upgraded from version 2 to 3. On npm start, which is webpack-dev-server –open –config build/webpack.dev.js1 I get the error: angular.js:15570 SyntaxError: Unexpected token I in JSON at position 0 at JSON.parse (<anonymous>) at fromJson (angular.js:1476) […]