Is it possible to create custom resolver in webpack?

Yes, it’s possible. To avoid ambiguity and for easier implementation, we’ll use a prefix hash symbol as marker of your convention: require(“#./components/SettingsPanel”); Then add this to your configuration file (of course, you can refactor it later): var webpack = require(‘webpack’); var path = require(‘path’); var MyConventionResolver = { apply: function(resolver) { resolver.plugin(‘module’, function(request, callback) { … Read more

Webpack: “there are multiple modules with names that only differ in casing” but modules referenced are identical

This is usually a result of a minuscule typo. For instance, if you are importing your modules like this: import Vue from ‘vue’ or: import Vuex from ‘vuex’ Go through your files and check where you used phrases like from ‘Vue’ or from ‘Vuex’ and make sure to use the exact same capitals (uppercase letters) … Read more

Cannot find module ‘webpack/bin/config-yargs’

If you’re using webpack-cli 4 or webpack 5, change webpack-dev-server to webpack serve. Example: “serve”: “webpack serve –config config/ –progress” You might want also check this comment on GitHub: NPM package.json scripts are a convenient and useful means to run locally installed binaries without having to be concerned about their full paths. Simply define a … Read more

How to inline CSS in the head tag of a NextJS project?

I managed to successfully inline my CSS by slightly tweaking the pages/_document.jsx file. I extended the <Head> component natively provided with NextJS and added it to my custom document markup. Here’s a partial representation of my modifications: import { readFileSync } from ‘fs’; import { join } from ‘path’; class InlineStylesHead extends Head { getCssLinks() … Read more

CORS error even after setting Access-Control-Allow-Origin or other Access-Control-Allow-* headers on client side

Access-Control-Allow-Origin is a response header the server the request goes to must send. And all other Access-Control-Allow-* headers are response headers for servers to send. If you don’t control the server your request is sent to, and the problem with the response is just the lack of the Access-Control-Allow-Origin header or other Access-Control-Allow-* headers you … Read more