Skip to content

Instantly share code, notes, and snippets.

View feedthejim's full-sized avatar
✌️

Jimmy Lai feedthejim

✌️
View GitHub Profile
import { Worker } from 'worker_threads'
import path from 'path'
import chalk from 'next/dist/compiled/chalk'
let worker: any
function prettyPrint(
node: any,
distDir: string,
prefix = '',
@feedthejim
feedthejim / import-timing-plugin.js
Created April 10, 2023 20:47
Webpack Import timing plugin
const { ConcatSource } = require('webpack-sources')
class ImportTimingPlugin {
constructor(options = {}) {
this.options = options
}
apply(compiler) {
compiler.hooks.compilation.tap('ImportTimingPlugin', (compilation) => {
compilation.hooks.processAssets.tap(
{
"presets": [
[
"@babel/preset-env",
{
"modules": false,
"targets": {
"browsers": "ie >= 11"
}
}