Skip to content

Instantly share code, notes, and snippets.

View evenstensberg's full-sized avatar
🐪

Even Stensberg evenstensberg

🐪
View GitHub Profile
@evenstensberg
evenstensberg / perf.sh
Created February 25, 2018 15:04
ESM perf on test suite
#!/usr/bin/env bash
T="$(date +%s)"
cd esm
npm run test
T="$(($(date +%s)-T))"
npm install --save v8-compile-cache
ex -sc '2i|require("v8-compile-cache")' -cx script/test.js
T2="$(date +%s)"
@evenstensberg
evenstensberg / test.js
Created May 29, 2019 09:10
Run from root in webpack-cli, this is the behaviour of merge prop atm
const yoConfig = {
"webpack-cli": {
"configuration": {
"config": {
"merge": "okay",
"topScope": [
"const webpack = require('webpack')",
"const path = require('path')",
"\n",
"/*\n * SplitChunksPlugin is enabled by default and replaced\n * deprecated CommonsChunkPlugin. It automatically identifies modules which\n * should be splitted of chunk by heuristics using module duplication count and\n * module category (i. e. node_modules). And splits the chunks…\n *\n * It is safe to remove \"splitChunks\" from the generated configuration\n * and was added as an educational example.\n *\n * https://webpack.js.org/plugins/split-chunks-plugin/\n *\n */",
@evenstensberg
evenstensberg / webpack.config.js
Last active April 3, 2020 16:42
Example Chunk Splitting Strategy
module.exports = {
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
name: 'vendor',
test: /[\\/]node_modules[\\/]/,
chunks: 'all',
maxSize: 500000
},
@evenstensberg
evenstensberg / webpack.config.js
Created April 22, 2020 13:39
Example webpack configuration
const path = require("path");
const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const isDev = true;
const isHmr = process.env.NODE_ENV === "hmr";
module.exports = {
devtool: "inline-source-map",