Install: npm i tiny-array-flat-polyfill
import 'tiny-array-flat-polyfill';
const ARR = [1, [2, [3]], [[[4]]], 5]
This loader optimizes the output of mini-css-extract-plugin
and/or css-loader
,
entirely removing the potentially large CSS classname mappings normally inlined into your bundle when using CSS Modules.
Run npm install constant-locals-loader
, then make these changes in your Webpack config:
module.exports = {
module: {
/* eslint-disable no-unused-vars */ | |
/* eslint-disable no-else-return */ | |
// JSX constructor, similar to createElement() | |
export const h = (type, props, ...children) => { | |
return { | |
type, | |
// Props will be an object for components and DOM nodes, but a string for | |
// text nodes | |
props, |
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key}) | |
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=> | |
// arrays | |
e.map?e.map((e,p)=>render(e,d,t.o&&t.o[p])): | |
// components | |
e.t.call?(e.i=render((render.c=e).t(Object.assign({children:e.c},e.p),e.s=t.s||{},t=> | |
render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),d.t=t=e):( | |
// create notes | |
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)), | |
// diff props |
var s; | |
function supportsModuleWorkers() { | |
if (s==null) { | |
s = false; | |
try { | |
new Worker('data:,', Object.defineProperty({}, 'type', { | |
get() { s = true; } | |
})).terminate(); | |
} catch (e) {} | |
} |
This is a version of the resolve module that is extended with support for Conditional Export Maps, including Package Exports as shipped in Node.
The resolve module powers module resolution in Webpack, Rollup and Browserify.
The module maintains the same API and functionality as the original resolve() module.