Categories
Mastering Development

Error: Cannot find module ‘ejs’, webpack does not compile the ejs module in the bundle.js file made through webpack.server.js

I keep getting the not found module for ejs and tried bunch of solutions. I am not sure why the ejs module does not compile to the file webpack builds. this is the error: Error: Failed to lookup view “pages/index” in views directory “/views” at Function.y.render (/Users/”user name”/projects/project-node-test/build/bundle.js:277:4330) package.json: “name”: “project-node”, “version”: “1.0.0”, “description”: “”, […]

Categories
Mastering Development

How to test react navigation authentication flow?

I’m developing a React Native application. I’m doing something like what’s explained here to implement the authentication flow. So, I created an AppContainer that looks like this: import {createAppContainer, createSwitchNavigator, createStackNavigator} from “react-navigation”; import AuthLoadingScreen from “../screens/auth/auth-loading-screen”; const AppStack = createStackNavigator({ Home: {screen: HomeScreen} }); const AuthStack = createStackNavigator({ SignIn: {screen: SignInScreen} }); const AppContainer […]

Categories
CMS Development Wordpress

Using Gutenberg block components in admin interface controls

I asked a previous question, and got a helpful answer that got me going quite a ways. The present problem is unrelated, but IMO reflects the dearth of documentation suitable for those of us who aren’t familiar with some of the nuances of javascript, are completely new to Gutenberg development, and yet need to tweak […]

Categories
CMS Development Wordpress

Using Gutenberg block components in admin interface controls

I asked a previous question, and got a helpful answer that got me going quite a ways. The present problem is unrelated, but IMO reflects the dearth of documentation suitable for those of us who aren’t familiar with some of the nuances of javascript, are completely new to Gutenberg development, and yet need to tweak […]

Categories
Mastering Development

Running webpack build issue while trying to create a React application using babel, webpack

I am working on a new project set up for react using webpack and babel. Following is the webpack.config.js file Folder structure: node_modules/ src/ – api/ – components/ – index.jsx – stats.html webpack.config.js babel.config.js const path = require(‘path’); const MiniCssExtractPlugin = require(‘mini-css-extract-plugin’); const { BundleAnalyzerPlugin } = require(‘webpack-bundle-analyzer’); const { ContextReplacementPlugin, HashedModuleIdsPlugin } = require(‘webpack’); […]

Categories
Development

Babel-node ignores or misbehaves when I add ignore option to babel.config.js

am using the command npx babel-node –ignore=’ ‘ –extensions=’.ts,.tsx,.js,.jsx,.es6,.es’ test.js to compile the script named test.js . test.js imports import template from ‘lodash-es/template’; and I would like it to be compiled too. Adding ignore or include or exclude options regex at babel.config.js doesn’t work. How do i add an inline –ignore option ({ ignore: [/node_modules\/(?!lodash-es)/] […]

Categories
Development

Hot reloading not being trigger – component malformed?

This has been baffling me for a few hours now & I can’t seem to work out why. My original theory was that react-router/redux was causing this issue but I have now stripped them out & hot reloading still does not occur. My original file structure is below: index.js import ‘@babel/polyfill’ import React from ‘react’ […]

Categories
Development

How to distribute package for expo? (.web.js, .js configuration)

I want to distribute a package for expo. This package was created while building my app in expo SDK36. Like many expo dependencies, I use massively the .ios.js, .android.js and .web.js extensions. While importing a source I have distributed on npm, resolver only import .js without any distinction. As an example this package should work […]

Categories
Development

Jest test passes locally but fails in azure devops

I have a react application using react-scripts 3.2.0 This is my test : jest.mock(‘./../shared/utils/getRequestWithDispatchUsing’, () => ({ __esModule: true, default: () => () => () => () => ‘getRequestWithDispatchUsing is success’, })); describe(‘getContractsUsing’, () => { const dispatch = jest.fn(action => action); const fetch = jest.fn(); const clientNumber = ‘clientNumber’; beforeEach(() => { jest.clearAllMocks(); }); […]