What does “The code generator has deoptimised the styling of [some file] as it exceeds the max of “100KB”” mean?

This is related to compact option of Babel compiler, which commands to “not include superfluous whitespace characters and line terminators. When set to ‘auto’ compact is set to true on input sizes of >100KB.” By default its value is “auto”, so that is probably the reason you are getting the warning message. See Babel documentation. … Read more

Webpack style-loader vs css-loader

The CSS loader takes a CSS file and returns the CSS with imports and url(…) resolved via webpack’s require functionality: var css = require(“css!./file.css”); // => returns css code from file.css, resolves imports and url(…) It doesn’t actually do anything with the returned CSS. The style loader takes CSS and actually inserts it into the … Read more

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

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

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

This is usually the result of a minuscule typo by wrongly using either an capital first letter or a lower case first letter when the opposite was needed. 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 … Read more

Webpack build failing with ERR_OSSL_EVP_UNSUPPORTED [duplicate]

I was able to fix it via: export NODE_OPTIONS=–openssl-legacy-provider sachaw’s comment to Node.js v17.0.0 – Error starting project in development mode #30078 But they say they fixed it: ijjk’s comment to Node.js v17.0.0 – Error starting project in development mode #30078: Hi, this has been updated in v11.1.3-canary.89 of Next.js, please update and give it … Read more

TypeError: MiniCssExtractPlugin is not a constructor

There is an open issue for this on the create-react-app repository. It looks like this comment has a temporary fix of adding the following to file package.json: The below works if you’re using Yarn: “resolutions”: { “mini-css-extract-plugin”: “2.4.5” }, Use the command below for npm: npm i -D –save-exact mini-css-extract-plugin@2.4.5 Update: As of January 17, … Read more