profile
viewpoint
Tobias Koppers sokra Germany Author of webpack

ScriptedAlchemy/webpack-external-import 322

Dynamically import modules from other webpack bundles. Painless code sharing between separate apps

GoogleChromeLabs/tooling.report 210

tooling.report a quick way to determine the best build tool for your next web project, or if tooling migration is worth it, or how to adopt a tool's best practice into your existing configuration and code base.

open-bot/open-bot 193

An unopinionated bot driven by a configuration file in the repository.

sokra/book-of-modern-frontend-tooling 11

The Front-end Tooling Book

shama/jmpress.js 10

This repo has moved! The repo you are looking for is now at jmpressjs/jmpress.js.

sokra/beautify-lint 7

A linter for code styling. Ensures code is written in a beautiful way.

sokra/async 5

Async utilities for node and the browser

sokra/domjs 3

Client and server side dom template engine

sokra/buffer-browserify 2

node's buffer module, but for the browser.

sokra/csg.js 2

Constructive solid geometry on meshes using BSP trees in JavaScript

Pull request review commentwebpack/webpack

add full Semantic Versioning for Shared Modules

+/*+	MIT License http://www.opensource.org/licenses/mit-license.php+	Author Tobias Koppers @sokra+*/++"use strict";++/** @typedef {(string|number|undefined|[])[]} SemVerRange */+/** @typedef {(string|number|undefined|[])[]} SemVerVersion */

Interesting idea. That's worth trying. I think I refactor the whole thing in a way to not leak the parsed version into the API, so all this is webpack internal and can be changed in future.

sokra

comment created time in an hour

Pull request review commentwebpack/webpack

add full Semantic Versioning for Shared Modules

+"use strict";++const {+	parseVersion,+	versionToString,+	versionLt,+	parseRange,+	rangeToString,+	satisfy+} = require("../lib/util/semver");++describe("SemVer", () => {+	it("should parseVersion correctly", () => {+		expect(parseVersion("1")).toEqual([1]);+		expect(parseVersion("1.2.3")).toEqual([1, 2, 3]);+		expect(parseVersion("1.2.3.4.999")).toEqual([1, 2, 3, 4, 999]);+		// eslint-disable-next-line no-sparse-arrays+		expect(parseVersion("1.2.3-beta")).toEqual([1, 2, 3, , "beta"]);+		// eslint-disable-next-line no-sparse-arrays+		expect(parseVersion("1.2.3-beta.1.2")).toEqual([1, 2, 3, , "beta", 1, 2]);+		// eslint-disable-next-line no-sparse-arrays+		expect(parseVersion("1.2.3-alpha.beta-42")).toEqual([+			1,+			2,+			3,+			,+			"alpha",+			"beta-42"+		]);+		// eslint-disable-next-line no-sparse-arrays+		expect(parseVersion("1.2.3-beta.1.alpha.0+5343")).toEqual([+			1,+			2,+			3,+			,+			"beta",+			1,+			"alpha",+			0,+			[],+			5343+		]);+		expect(parseVersion("1.2.3+5343.beta+1")).toEqual([+			1,+			2,+			3,+			[],+			5343,+			"beta+1"+		]);+		expect(parseVersion("1.2.3+5343.beta+1")).toEqual([+			1,+			2,+			3,+			[],+			5343,+			"beta+1"+		]);+	});++	describe("versionToString", () => {+		const cases = [+			"0.0.0",+			"0.0.1",+			"0.1.2",+			"1.2.3",+			"1.0.0",+			"1.2.3.4.5.6.7.8",+			"1.2",+			"1",+			"1.2.3-beta",+			"1.2.3-beta.15",+			"1.2.3-beta.15+45",+			"1.2.3-beta.15+45.67",+			"1.2.3+45",+			"1.2.3+45.67",+			"1.2.3-beta-gamma-test+x+y+z"+		];+		for (const key of cases) {+			it(`should ${key} stringify correctly`, () => {+				expect(versionToString(parseVersion(key))).toEqual(key);+			});+		}+	});++	describe("versionLt", () => {+		const cases = [+			"1 < 2",+			"99 < 100",+			"1 < 1.2",+			"1 < 1.2.3",+			"1.2 < 1.2.3",+			"1.2.2 < 1.2.3",+			"1.1.3 < 1.2.0",+			"1.1.3 < 2.0.0",+			"1.1.3 < 2",+			"1.1.3 < 2.0",+			"1.2.3 < 1.2.3+0",+			"1.2.3+23 < 1.2.3+123",+			"1.2+2 < 1.2.3+1",+			"1.2.3-beta < 1.2.3",+			"1.2.3 < 1.2.4-beta",+			"1.2.3 < 1.3.0-beta",+			"1.2.3 < 2.0.0-beta",+			"1.2.3-alpha < 1.2.3-beta",+			"1.2.3-beta < 1.2.3.1",+			"1.2.3-beta < 1.2.3-beta.0",+			"1.2.3-beta.0 < 1.2.3-beta.1",+			"1.2.3-0 < 1.2.3-beta",+			"1.2.3-beta < 1.2.3-beta+123",+			"1.2.3-beta+123 < 1.2.3-beta+234",+			"1.2.3-beta+99 < 1.2.3-beta+111"+		];+		for (const c of cases) {+			it(c, () => {+				const parts = c.split(" < ");+				const a = parseVersion(parts[0]);+				const b = parseVersion(parts[1]);+				expect(versionLt(a, a)).toBe(false);+				expect(versionLt(b, b)).toBe(false);+				expect(versionLt(a, b)).toBe(true);+				expect(versionLt(b, a)).toBe(false);+			});+		}+	});++	describe("parseRange", () => {+		const cases = {+			"=3": ["3", "v3", "3.x", "3.X", "3.x.x", "3.*", "3.*.*", "^3", "^3.x"],+			"=3.0": ["3.0", "v3.0", "3.0.x", "3.0.X", "3.0.*", "~3.0"],+			"^3.4": ["^3.4.*"],+			"3.4 - 6.5": [">=3.4 <=6.5"],+			"<=3.4": ["<3.4 || =3.4"],+			">3.4": [">=3.4 !3.4"]+		};+		for (const key of Object.keys(cases)) {+			describe(key, () => {+				for (const c of cases[key])+					it(`should be equal ${c}`, () => {+						expect(parseRange(c)).toEqual(parseRange(key));+					});+			});+		}+	});++	describe("rangeToString", () => {+		const cases = {+			"1": "^1",+			"1.2": "~1.2",+			"1.2.3": "=1.2.3",+			"^1.2.3": "^1.2.3",+			"~1.2.3": "~1.2.3",+			"0.0.1": "=0.0.1",+			"^0.0.1": "=0.0.1",+			"^0.1.2": "~0.1.2",+			"~0.0.1": "~0.0.1",+			"~0.1.2": "~0.1.2",+			">=1.2.3": ">=1.2.3",+			"1.2.3-beta.25": "=1.2.3-beta.25",+			"1.2.3-beta.25+12.34": "=1.2.3-beta.25+12.34",+			"1.2.3+12.34": "=1.2.3+12.34",+			">=1.2.3-beta.25": ">=1.2.3-beta.25",+			">=1.2.3-beta.25+12.34": ">=1.2.3-beta.25+12.34",+			">=1.2.3+12.34": ">=1.2.3+12.34",+			"<1.2.3-beta.25": "<1.2.3-beta.25",+			"<1.2.3-beta.25+12.34": "<1.2.3-beta.25+12.34",+			"<1.2.3+12.34": "<1.2.3+12.34",+			"1.2.3 - 3.2.1": ">=1.2.3 (<3.2.1 || =3.2.1)",+			">3.4": ">=3.4 not(~3.4)",+			"1 || 2 || 3": "^1 || ^2 || ^3",+			"1.2.3 - 3.2.1 || >3 <=4 || 1":+				">=1.2.3 (<3.2.1 || =3.2.1) || >=3 not(^3) (<4 || ^4) || ^1"+		};+		for (const key of Object.keys(cases)) {+			const expected = cases[key];+			it(`should ${key} stringify to ${expected}`, () => {+				expect(rangeToString(parseRange(key))).toEqual(expected);+			});+		}+	});++	describe("satisfies", () => {+		const cases = {+			// table cases+			">=1": [+				"1",+				"2",+				"!1-beta",+				"!2-beta",+				"1.2",+				"!1.2-beta",+				"2.2",+				"!2.2-beta",+				"1.beta",+				"!1.beta-beta",+				"!2.beta-beta"+			],+			">=1-beta": [+				"1",+				"2",+				"1-beta",+				"1-gamma",+				"!1-alpha",+				"!2-beta",+				"1.2",+				"!1.2-beta",+				"2.2",+				"!2.2-beta",+				"1.beta",+				"!1.beta-beta",+				"2.beta",+				"!2.beta-beta"+			],+			">=1.2": [+				"!1",+				"2",+				"!1-beta",+				"!2-beta",+				"!1.1",+				"1.2",+				"1.3",+				"2.1",+				"2.2",+				"2.3",+				"1.beta",+				"2.beta"+			],+			"~1.2": [+				"!1",+				"!2",+				"!10",+				"!1-beta",+				"!2-beta",+				"!1.1",+				"1.2",+				"!1.3",+				"!1.20"+			],+			">=1.beta": [+				"!1",+				"2",+				"!1-beta",+				"!2-beta",+				"!1.2",+				"2.2",+				"!1.0",+				"!1.100",+				"!1.alpha",+				"1.beta",+				"1.gamma",+				"2.beta"+			],+			// fixed cases+			"2": [+				"2",+				"2.0.0",+				"2.99.99",+				"!2.3.4-beta",+				"!2.3.4-beta.1",+				"!2.3.4-beta+123",+				"2.3.4+123",+				"!1",+				"!1.2.3",+				"!3",+				"!3.4.5"+			],+			"1.2.3-beta.1.2+33.44": [+				"1.2.3-beta.1.2+33.44",+				"!1.2.3-beta.1.2+33.44.55",

ok. That would simplify the logic a little bit. I would omit build version during parsing the ranges.

sokra

comment created time in an hour

issue commentwebpack/webpack

Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

It will split the multiple into multiple files (chunks) so it only have to load the files it needs. So if react is a shared modules it will be put into a separate file together with the depenendencies. This happens for each build. In the end each build will have a separate file for react and they may have react in different versions. During initialization each build will provide the info about which version of react it provides together with a way to load this version. When a build wants to load react it selects the highest version from the list of provided modules that satisfy the requested version range, and loads it.

ScriptedAlchemy

comment created time in 14 hours

issue commentwebpack/webpack

Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

Btw I wonder why you are using such a weird syntax? It equal, but this looks nicer:

shared: ​{​ ​'@material-ui/styles/esm/StylesProvider'​: ​{​ ​singleton​: ​true​ ​}​,​
  ​{​ ​'@material-ui/styles/esm/useTheme/ThemeContext'​: ​{​ ​singleton​: ​true​ ​}​ ,​
  ​{​ ​react​: ​{​ ​singleton​: ​true​ ​}​,​
  ​{​ ​'react-dom'​: ​{​ ​singleton​: ​true​
​}
ScriptedAlchemy

comment created time in 16 hours

issue commentwebpack/webpack

Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

Are they referenced this way, like import "@material-ui/styles/esm/StylesProvider"?

ScriptedAlchemy

comment created time in 16 hours

Pull request review commentwebpack/webpack

add full Semantic Versioning for Shared Modules

+/*+	MIT License http://www.opensource.org/licenses/mit-license.php+	Author Tobias Koppers @sokra+*/++"use strict";++/** @typedef {(string|number|undefined|[])[]} SemVerRange */+/** @typedef {(string|number|undefined|[])[]} SemVerVersion */++const removeStars = arr => {+	while (/^[Xx*]$/.test(arr[arr.length - 1])) arr.pop();+	return arr;+};++/**+ * @param {string} str version string+ * @returns {SemVerVersion} parsed version+ */+const parseVersion = str => {+	if (!str) return [];+	const match = /^([^-+]+)(?:-([^+]+))?(?:\+(.+))?$/.exec(str);+	const convertToNumber = item => (`${+item}` === item ? +item : item);+	const version = removeStars(match[1].split(".").map(convertToNumber));+	const prerelease = match[2]+		? removeStars(match[2].split(".").map(convertToNumber))+		: [];+	const build = match[3] ? match[3].split(".").map(convertToNumber) : [];+	if (prerelease.length) {+		return build.length+			? // eslint-disable-next-line no-sparse-arrays+			  [...version, , ...prerelease, [], ...build]+			: // eslint-disable-next-line no-sparse-arrays+			  [...version, , ...prerelease];+	} else {+		// eslint-disable-next-line no-sparse-arrays+		return build.length ? [...version, [], ...build] : version;+	}+};+exports.parseVersion = parseVersion;++/* eslint-disable eqeqeq */+const versionToString = version => {+	if (!version) return "[unknown]";+	for (var str = "", needDot = 1, i = 0; i < version.length; i++) {+		var item = version[i];+		var t = (typeof item)[0];+		needDot--;+		str +=+			t == "u"+				? // undefined: prerelease marker, add an "-"+				  "-"+				: t == "o"+				? // object: build marker, add an "+"+				  "+"+				: // number or string: add the item, set flag to add an "." between two of them+				  (needDot > 0 ? "." : "") + ((needDot = 2), item);+	}+	return str;+};+/* eslint-enable eqeqeq */+exports.versionToString = versionToString;++// must be a minimized version of above+exports.versionToStringRuntimeCode = runtimeTemplate =>+	`var versionToString = ${runtimeTemplate.basicFunction("version", [+		"// see webpack/lib/util/semver.js for original code",+		'if(!version)return"[unknown]";for(var r="",n=1,o=0;o<version.length;o++){var e=version[o],t=(typeof e)[0];n--,r+="u"==t?"-":"o"==t?"+":(n>0?".":"")+(n=2,e)}return r'

This is not needed. The code runs through a minimizier anyway. Maybe we should switch off mangling for this at all.

sokra

comment created time in a day

Pull request review commentwebpack/webpack

add full Semantic Versioning for Shared Modules

+"use strict";++const {+	parseVersion,+	versionToString,+	versionLt,+	parseRange,+	rangeToString,+	satisfy+} = require("../lib/util/semver");++describe("SemVer", () => {+	it("should parseVersion correctly", () => {+		expect(parseVersion("1")).toEqual([1]);+		expect(parseVersion("1.2.3")).toEqual([1, 2, 3]);+		expect(parseVersion("1.2.3.4.999")).toEqual([1, 2, 3, 4, 999]);+		// eslint-disable-next-line no-sparse-arrays+		expect(parseVersion("1.2.3-beta")).toEqual([1, 2, 3, , "beta"]);+		// eslint-disable-next-line no-sparse-arrays+		expect(parseVersion("1.2.3-beta.1.2")).toEqual([1, 2, 3, , "beta", 1, 2]);+		// eslint-disable-next-line no-sparse-arrays+		expect(parseVersion("1.2.3-alpha.beta-42")).toEqual([+			1,+			2,+			3,+			,+			"alpha",+			"beta-42"+		]);+		// eslint-disable-next-line no-sparse-arrays+		expect(parseVersion("1.2.3-beta.1.alpha.0+5343")).toEqual([+			1,+			2,+			3,+			,+			"beta",+			1,+			"alpha",+			0,+			[],+			5343+		]);+		expect(parseVersion("1.2.3+5343.beta+1")).toEqual([+			1,+			2,+			3,+			[],+			5343,+			"beta+1"+		]);+		expect(parseVersion("1.2.3+5343.beta+1")).toEqual([+			1,+			2,+			3,+			[],+			5343,+			"beta+1"+		]);+	});++	describe("versionToString", () => {+		const cases = [+			"0.0.0",+			"0.0.1",+			"0.1.2",+			"1.2.3",+			"1.0.0",+			"1.2.3.4.5.6.7.8",+			"1.2",+			"1",+			"1.2.3-beta",+			"1.2.3-beta.15",+			"1.2.3-beta.15+45",+			"1.2.3-beta.15+45.67",+			"1.2.3+45",+			"1.2.3+45.67",+			"1.2.3-beta-gamma-test+x+y+z"+		];+		for (const key of cases) {+			it(`should ${key} stringify correctly`, () => {+				expect(versionToString(parseVersion(key))).toEqual(key);+			});+		}+	});++	describe("versionLt", () => {+		const cases = [+			"1 < 2",+			"99 < 100",+			"1 < 1.2",+			"1 < 1.2.3",+			"1.2 < 1.2.3",+			"1.2.2 < 1.2.3",+			"1.1.3 < 1.2.0",+			"1.1.3 < 2.0.0",+			"1.1.3 < 2",+			"1.1.3 < 2.0",+			"1.2.3 < 1.2.3+0",+			"1.2.3+23 < 1.2.3+123",+			"1.2+2 < 1.2.3+1",+			"1.2.3-beta < 1.2.3",+			"1.2.3 < 1.2.4-beta",+			"1.2.3 < 1.3.0-beta",+			"1.2.3 < 2.0.0-beta",+			"1.2.3-alpha < 1.2.3-beta",+			"1.2.3-beta < 1.2.3.1",+			"1.2.3-beta < 1.2.3-beta.0",+			"1.2.3-beta.0 < 1.2.3-beta.1",+			"1.2.3-0 < 1.2.3-beta",+			"1.2.3-beta < 1.2.3-beta+123",+			"1.2.3-beta+123 < 1.2.3-beta+234",+			"1.2.3-beta+99 < 1.2.3-beta+111"+		];+		for (const c of cases) {+			it(c, () => {+				const parts = c.split(" < ");+				const a = parseVersion(parts[0]);+				const b = parseVersion(parts[1]);+				expect(versionLt(a, a)).toBe(false);+				expect(versionLt(b, b)).toBe(false);+				expect(versionLt(a, b)).toBe(true);+				expect(versionLt(b, a)).toBe(false);+			});+		}+	});++	describe("parseRange", () => {+		const cases = {+			"=3": ["3", "v3", "3.x", "3.X", "3.x.x", "3.*", "3.*.*", "^3", "^3.x"],+			"=3.0": ["3.0", "v3.0", "3.0.x", "3.0.X", "3.0.*", "~3.0"],+			"^3.4": ["^3.4.*"],+			"3.4 - 6.5": [">=3.4 <=6.5"],+			"<=3.4": ["<3.4 || =3.4"],+			">3.4": [">=3.4 !3.4"]+		};+		for (const key of Object.keys(cases)) {+			describe(key, () => {+				for (const c of cases[key])+					it(`should be equal ${c}`, () => {+						expect(parseRange(c)).toEqual(parseRange(key));+					});+			});+		}+	});++	describe("rangeToString", () => {+		const cases = {+			"1": "^1",+			"1.2": "~1.2",+			"1.2.3": "=1.2.3",+			"^1.2.3": "^1.2.3",+			"~1.2.3": "~1.2.3",+			"0.0.1": "=0.0.1",+			"^0.0.1": "=0.0.1",+			"^0.1.2": "~0.1.2",+			"~0.0.1": "~0.0.1",+			"~0.1.2": "~0.1.2",+			">=1.2.3": ">=1.2.3",+			"1.2.3-beta.25": "=1.2.3-beta.25",+			"1.2.3-beta.25+12.34": "=1.2.3-beta.25+12.34",+			"1.2.3+12.34": "=1.2.3+12.34",+			">=1.2.3-beta.25": ">=1.2.3-beta.25",+			">=1.2.3-beta.25+12.34": ">=1.2.3-beta.25+12.34",+			">=1.2.3+12.34": ">=1.2.3+12.34",+			"<1.2.3-beta.25": "<1.2.3-beta.25",+			"<1.2.3-beta.25+12.34": "<1.2.3-beta.25+12.34",+			"<1.2.3+12.34": "<1.2.3+12.34",+			"1.2.3 - 3.2.1": ">=1.2.3 (<3.2.1 || =3.2.1)",+			">3.4": ">=3.4 not(~3.4)",+			"1 || 2 || 3": "^1 || ^2 || ^3",+			"1.2.3 - 3.2.1 || >3 <=4 || 1":+				">=1.2.3 (<3.2.1 || =3.2.1) || >=3 not(^3) (<4 || ^4) || ^1"+		};+		for (const key of Object.keys(cases)) {+			const expected = cases[key];+			it(`should ${key} stringify to ${expected}`, () => {+				expect(rangeToString(parseRange(key))).toEqual(expected);+			});+		}+	});++	describe("satisfies", () => {+		const cases = {+			// table cases+			">=1": [+				"1",+				"2",+				"!1-beta",+				"!2-beta",+				"1.2",+				"!1.2-beta",+				"2.2",+				"!2.2-beta",+				"1.beta",+				"!1.beta-beta",+				"!2.beta-beta"+			],+			">=1-beta": [+				"1",+				"2",+				"1-beta",+				"!1-gamma",+				"!1-alpha",+				"!2-beta",+				"1.2",+				"!1.2-beta",+				"2.2",+				"!2.2-beta",+				"1.beta",+				"!1.beta-beta",+				"2.beta",+				"!2.beta-beta"+			],+			">=1.2": [+				"!1",+				"2",+				"!1-beta",+				"!2-beta",+				"!1.1",+				"1.2",+				"1.3",+				"2.1",+				"2.2",+				"2.3",+				"!1.beta",+				"2.beta"+			],+			"~1.2": [+				"!1",+				"!2",+				"!10",+				"!1-beta",+				"!2-beta",+				"!1.1",+				"1.2",+				"!1.3",+				"!1.20"+			],+			">=1.beta": [+				"!1",+				"2",+				"!1-beta",+				"!2-beta",+				"!1.2",+				"2.2",+				"!1.alpha",+				"1.beta",+				"!1.gamma",+				"2.beta"+			],+			// fixed cases+			"2": [+				"2",+				"2.0.0",+				"2.99.99",+				"!2.3.4-beta",+				"!2.3.4-beta.1",+				"!2.3.4-beta+123",+				"2.3.4+123",+				"!1",+				"!1.2.3",+				"!3",+				"!3.4.5"+			],+			"1.2.3-beta.1.2+33.44": [+				"1.2.3-beta.1.2+33.44",+				"!1.2.3-beta.1.2+33.44.55",+				"!1.2.3-beta.1.2.3+33.44",+				"!1.2.3.4-beta.1.2+33.44",+				"!1.2.3-beta.1.2+33",+				"!1.2.3-beta.1.2",+				"!1.2.3-beta",+				"!1.2-beta.1.2+33.44",+				"!1.2.3+33.44",+				"!1.2.3",+				"!1"+			],+			"1.2.3+33.44": [+				"1.2.3+33.44",+				"!1.2.4+33.44",+				"!1.2.3+33.55",+				"!1.2.3-beta+33.44",+				"!1.2.3+33.44.55",+				"!1.2.3+33",+				"!1.2+33.44",+				"!1.2.3.4+33.44",+				"!1.2.3",+				"!1.2.4",+				"!1.3",+				"!1",+				"!2"+			],+			"1.2.3-beta.1.2": [+				"1.2.3-beta.1.2",+				"!1.2.3-beta.1.2+33",+				"!1.2.3-beta.1.2.3",+				"!1.2.3.4-beta.1.2",+				"!1.2.3-beta",+				"!1.2-beta.1.2",+				"!1.2.3+33",+				"!1.2.3",+				"!1"+			],+			"^2.3.4": [+				"2.3.4",+				"2.3.5",+				"2.4.0",+				"!3.3.4",+				"!1.5.6",+				"!2.3.3",+				"!2.3.4-beta",+				"!2.3.5-beta",+				"2.3.4.test",+				"!2.3.test",+				"2.3.4+33",+				"2.3.5+33",+				"2.4.0+33",+				"2.3.4.5"+			],+			"~2.3.4": [+				"2.3.4",+				"2.3.5",+				"!2.4.0",+				"!3.3.4",+				"!1.5.6",+				"!2.3.3",+				"!2.3.4-beta",+				"!2.3.5-beta",+				"2.3.4.test",+				"!2.3.test",+				"2.3.4+33",+				"2.3.5+33",+				"!2.4.0+33",+				"2.3.4.5"+			],+			"!2.3": [

fixed, added the test case

sokra

comment created time in a day

Pull request review commentwebpack/webpack

add full Semantic Versioning for Shared Modules

+"use strict";++const {+	parseVersion,+	versionToString,+	versionLt,+	parseRange,+	rangeToString,+	satisfy+} = require("../lib/util/semver");++describe("SemVer", () => {+	it("should parseVersion correctly", () => {+		expect(parseVersion("1")).toEqual([1]);+		expect(parseVersion("1.2.3")).toEqual([1, 2, 3]);+		expect(parseVersion("1.2.3.4.999")).toEqual([1, 2, 3, 4, 999]);+		// eslint-disable-next-line no-sparse-arrays+		expect(parseVersion("1.2.3-beta")).toEqual([1, 2, 3, , "beta"]);+		// eslint-disable-next-line no-sparse-arrays+		expect(parseVersion("1.2.3-beta.1.2")).toEqual([1, 2, 3, , "beta", 1, 2]);+		// eslint-disable-next-line no-sparse-arrays+		expect(parseVersion("1.2.3-alpha.beta-42")).toEqual([+			1,+			2,+			3,+			,+			"alpha",+			"beta-42"+		]);+		// eslint-disable-next-line no-sparse-arrays+		expect(parseVersion("1.2.3-beta.1.alpha.0+5343")).toEqual([+			1,+			2,+			3,+			,+			"beta",+			1,+			"alpha",+			0,+			[],+			5343+		]);+		expect(parseVersion("1.2.3+5343.beta+1")).toEqual([+			1,+			2,+			3,+			[],+			5343,+			"beta+1"+		]);+		expect(parseVersion("1.2.3+5343.beta+1")).toEqual([+			1,+			2,+			3,+			[],+			5343,+			"beta+1"+		]);+	});++	describe("versionToString", () => {+		const cases = [+			"0.0.0",+			"0.0.1",+			"0.1.2",+			"1.2.3",+			"1.0.0",+			"1.2.3.4.5.6.7.8",+			"1.2",+			"1",+			"1.2.3-beta",+			"1.2.3-beta.15",+			"1.2.3-beta.15+45",+			"1.2.3-beta.15+45.67",+			"1.2.3+45",+			"1.2.3+45.67",+			"1.2.3-beta-gamma-test+x+y+z"+		];+		for (const key of cases) {+			it(`should ${key} stringify correctly`, () => {+				expect(versionToString(parseVersion(key))).toEqual(key);+			});+		}+	});++	describe("versionLt", () => {+		const cases = [+			"1 < 2",+			"99 < 100",+			"1 < 1.2",+			"1 < 1.2.3",+			"1.2 < 1.2.3",+			"1.2.2 < 1.2.3",+			"1.1.3 < 1.2.0",+			"1.1.3 < 2.0.0",+			"1.1.3 < 2",+			"1.1.3 < 2.0",+			"1.2.3 < 1.2.3+0",+			"1.2.3+23 < 1.2.3+123",+			"1.2+2 < 1.2.3+1",+			"1.2.3-beta < 1.2.3",+			"1.2.3 < 1.2.4-beta",+			"1.2.3 < 1.3.0-beta",+			"1.2.3 < 2.0.0-beta",+			"1.2.3-alpha < 1.2.3-beta",+			"1.2.3-beta < 1.2.3.1",+			"1.2.3-beta < 1.2.3-beta.0",+			"1.2.3-beta.0 < 1.2.3-beta.1",+			"1.2.3-0 < 1.2.3-beta",+			"1.2.3-beta < 1.2.3-beta+123",+			"1.2.3-beta+123 < 1.2.3-beta+234",+			"1.2.3-beta+99 < 1.2.3-beta+111"+		];+		for (const c of cases) {+			it(c, () => {+				const parts = c.split(" < ");+				const a = parseVersion(parts[0]);+				const b = parseVersion(parts[1]);+				expect(versionLt(a, a)).toBe(false);+				expect(versionLt(b, b)).toBe(false);+				expect(versionLt(a, b)).toBe(true);+				expect(versionLt(b, a)).toBe(false);+			});+		}+	});++	describe("parseRange", () => {+		const cases = {+			"=3": ["3", "v3", "3.x", "3.X", "3.x.x", "3.*", "3.*.*", "^3", "^3.x"],+			"=3.0": ["3.0", "v3.0", "3.0.x", "3.0.X", "3.0.*", "~3.0"],+			"^3.4": ["^3.4.*"],+			"3.4 - 6.5": [">=3.4 <=6.5"],+			"<=3.4": ["<3.4 || =3.4"],+			">3.4": [">=3.4 !3.4"]+		};+		for (const key of Object.keys(cases)) {+			describe(key, () => {+				for (const c of cases[key])+					it(`should be equal ${c}`, () => {+						expect(parseRange(c)).toEqual(parseRange(key));+					});+			});+		}+	});++	describe("rangeToString", () => {+		const cases = {+			"1": "^1",+			"1.2": "~1.2",+			"1.2.3": "=1.2.3",+			"^1.2.3": "^1.2.3",+			"~1.2.3": "~1.2.3",+			"0.0.1": "=0.0.1",+			"^0.0.1": "=0.0.1",+			"^0.1.2": "~0.1.2",+			"~0.0.1": "~0.0.1",+			"~0.1.2": "~0.1.2",+			">=1.2.3": ">=1.2.3",+			"1.2.3-beta.25": "=1.2.3-beta.25",+			"1.2.3-beta.25+12.34": "=1.2.3-beta.25+12.34",+			"1.2.3+12.34": "=1.2.3+12.34",+			">=1.2.3-beta.25": ">=1.2.3-beta.25",+			">=1.2.3-beta.25+12.34": ">=1.2.3-beta.25+12.34",+			">=1.2.3+12.34": ">=1.2.3+12.34",+			"<1.2.3-beta.25": "<1.2.3-beta.25",+			"<1.2.3-beta.25+12.34": "<1.2.3-beta.25+12.34",+			"<1.2.3+12.34": "<1.2.3+12.34",+			"1.2.3 - 3.2.1": ">=1.2.3 (<3.2.1 || =3.2.1)",+			">3.4": ">=3.4 not(~3.4)",+			"1 || 2 || 3": "^1 || ^2 || ^3",+			"1.2.3 - 3.2.1 || >3 <=4 || 1":+				">=1.2.3 (<3.2.1 || =3.2.1) || >=3 not(^3) (<4 || ^4) || ^1"+		};+		for (const key of Object.keys(cases)) {+			const expected = cases[key];+			it(`should ${key} stringify to ${expected}`, () => {+				expect(rangeToString(parseRange(key))).toEqual(expected);+			});+		}+	});++	describe("satisfies", () => {+		const cases = {+			// table cases+			">=1": [+				"1",+				"2",+				"!1-beta",+				"!2-beta",+				"1.2",+				"!1.2-beta",+				"2.2",+				"!2.2-beta",+				"1.beta",+				"!1.beta-beta",+				"!2.beta-beta"+			],+			">=1-beta": [+				"1",+				"2",+				"1-beta",+				"!1-gamma",

TIL. fix that

sokra

comment created time in a day

Pull request review commentwebpack/webpack

add full Semantic Versioning for Shared Modules

 const { join, dirname, readJson } = require("../util/fs");  /** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -/**- * @param {string} version version as string- * @returns {(number|string)[]} version as array- */-exports.parseRequiredVersion = version => {-	if (version === "*") return [];-	let fuzzyStart = Infinity;-	if (version.startsWith(">=")) {-		fuzzyStart = 0;-		version = version.slice(2);-	} else if (version.startsWith("^")) {-		fuzzyStart = 1;-		version = version.slice(1);-	} else if (version.startsWith("~")) {-		fuzzyStart = 2;-		version = version.slice(1);-	}-	return version-		.split(".")-		.map((x, i) => (i >= fuzzyStart && `${+x}` === x ? +x : x));-};--/**- * @param {string} version version as string- * @returns {(number|string)[]} version as array- */-exports.parseVersion = version => {-	return version.split(".").map(x => (`${+x}` === x ? +x : x));-};--/**- * @param {(number|string)[]} version version- * @returns {string} version as string- */-exports.versionToString = version => {-	if (!version) return "(unknown)";-	if (version.length === 0) return "*";-	const info = version.map(value =>-		typeof value !== "string"-			? {-					type: "min",-					value: `${value}`-			  }-			: `${+value}` === value-			? {-					type: "exact",-					value-			  }-			: {-					type: "tag",-					value-			  }-	);-	switch (`${info[0].type}.${info.length > 1 ? info[1].type : "undefined"}`) {-		case "exact.min":-		case "tag.min":-			if (!info.slice(2).some(i => i.type === "exact"))-				return `^${version.join(".")}`;-			break;--		case "exact.exact":-		case "exact.tag":-		case "tag.exact":-		case "tag.tag":-			if (!info.slice(2).some(i => i.type === "exact"))-				return `~${version.join(".")}`;-			else if (!info.slice(2).some(i => i.type === "min"))-				return version.join(".");-			break;--		case "min.min":-		case "min.tag":-			if (!info.slice(2).some(i => i.type === "exact"))-				return `>=${version.join(".")}`;-			break;--		case "min.undefined":-			return `>=${version.join(".")}`;--		case "exact.undefined":-		case "tag.undefined":-			return version.join(".");-	}-	return info-		.map(i => (i.type === "exact" ? i.value : `[>=${i.value}]`))-		.join(".");-};- /**  * @param {string} str maybe required version  * @returns {boolean} true, if it looks like a version  */ exports.isRequiredVersion = str => { 	if (str === "*") return true;-	if (/&&|\|\|/.test(str)) return false;-	if (str.startsWith("^")) return true;-	if (str.startsWith("~")) return true;-	if (str.startsWith(">=")) return true;-	return /^\d/.test(str);+	return /^[\d^=<>~]/.test(str) || /\|\|/.test(str);

fixed

sokra

comment created time in a day

Pull request review commentwebpack/webpack

add full Semantic Versioning for Shared Modules

 const { join, dirname, readJson } = require("../util/fs");  /** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ -/**- * @param {string} version version as string- * @returns {(number|string)[]} version as array- */-exports.parseRequiredVersion = version => {-	if (version === "*") return [];-	let fuzzyStart = Infinity;-	if (version.startsWith(">=")) {-		fuzzyStart = 0;-		version = version.slice(2);-	} else if (version.startsWith("^")) {-		fuzzyStart = 1;-		version = version.slice(1);-	} else if (version.startsWith("~")) {-		fuzzyStart = 2;-		version = version.slice(1);-	}-	return version-		.split(".")-		.map((x, i) => (i >= fuzzyStart && `${+x}` === x ? +x : x));-};--/**- * @param {string} version version as string- * @returns {(number|string)[]} version as array- */-exports.parseVersion = version => {-	return version.split(".").map(x => (`${+x}` === x ? +x : x));-};--/**- * @param {(number|string)[]} version version- * @returns {string} version as string- */-exports.versionToString = version => {-	if (!version) return "(unknown)";-	if (version.length === 0) return "*";-	const info = version.map(value =>-		typeof value !== "string"-			? {-					type: "min",-					value: `${value}`-			  }-			: `${+value}` === value-			? {-					type: "exact",-					value-			  }-			: {-					type: "tag",-					value-			  }-	);-	switch (`${info[0].type}.${info.length > 1 ? info[1].type : "undefined"}`) {-		case "exact.min":-		case "tag.min":-			if (!info.slice(2).some(i => i.type === "exact"))-				return `^${version.join(".")}`;-			break;--		case "exact.exact":-		case "exact.tag":-		case "tag.exact":-		case "tag.tag":-			if (!info.slice(2).some(i => i.type === "exact"))-				return `~${version.join(".")}`;-			else if (!info.slice(2).some(i => i.type === "min"))-				return version.join(".");-			break;--		case "min.min":-		case "min.tag":-			if (!info.slice(2).some(i => i.type === "exact"))-				return `>=${version.join(".")}`;-			break;--		case "min.undefined":-			return `>=${version.join(".")}`;--		case "exact.undefined":-		case "tag.undefined":-			return version.join(".");-	}-	return info-		.map(i => (i.type === "exact" ? i.value : `[>=${i.value}]`))-		.join(".");-};- /**  * @param {string} str maybe required version  * @returns {boolean} true, if it looks like a version  */ exports.isRequiredVersion = str => { 	if (str === "*") return true;

fixed, I merged both regexp

sokra

comment created time in a day

push eventwebpack/webpack

Tobias Koppers

commit sha 655b19b4b53d1d563190fff003bfa3ad5fe04206

improve semver range detection

view details

push time in a day

push eventwebpack/webpack

Tobias Koppers

commit sha a2c14facccfd941b5e926e894e20911ae7766ef4

improve semver range detection

view details

Tobias Koppers

commit sha c6298afa3e110d15d23a6d01a39951413b3b96d5

fix matching of string version in prerelease ranges versions are in a contiguous range of: 0, 1, ..., 9, 10, 11, ..., 100, ..., a, b, c, ..., alpha, ..., beta, ..., etc, ...

view details

Tobias Koppers

commit sha f1051b765df8c4fe54985eefd79ca33492482ad1

Size optimization

view details

push time in a day

push eventwebpack/webpack.js.org

Travis CI

commit sha 6dfafd8103fdb921788f8cd2c2d60d7353513f1d

Updates

view details

push time in a day

issue commentwebpack/webpack

Initial chunks that fail to load stop entire app from booting

That's working as expected and specced. If you want to have control over loading failure of a part of you application use import().

splitChunks doesn't change the behavior of the code.

gpoitch

comment created time in a day

issue commentwebpack/webpack

Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

@zhangwilling technically all values for libraries are possible.

Using umd doesn't mean you can use it in node. You also need to use the correct target.

But with umd you should be able to use it with require.js. Not sure why you want this...

ScriptedAlchemy

comment created time in a day

issue commentwebpack/webpack

Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

@trusktr There are two major selling points of MF compared to other solutions.

Importing remote modules is not one of them. That's comparable easy with other solutions too, and it has been done in the past.

The first point is the shared modules system. It's a easy and automatic way of sharing modules in the whole system. It understands semver to deduplicate modules, and is aware of singleton modules that must only exist once.

The second point is performance. Even without compile-time knowledge of the other builds it's able to achieve the webpack standard of a single roundtrip per import(). Modules are bundled into chunks for better compression and less requests. Roundtrip-wise this is comparable with a single build solution, except for the initial page load which requires 1 additional roundtrip, resulting in the total of 2 round-trips after the HTML has been loaded (inlining would help, but affects caching negatively). All output files are long term cachable, except the entry to the build that can't be cached as it would prevent new deploys. This could be the small container entry file or a redirect to it.

It's probably also possible to craft a solution on top of ESM. But the ideas I have lack behind this solution:

Most ESM based solutions have an waterfall loading problem which result in too many requests.

Too small modules (not bundled) have an request overhead and bad compression problem. So you need to bundle your esm too.

To handle semver deduplicating you could offer an server side api that redirects, which has an extra roundtrip and is not cachable. Or you could generate a imports map, which either requires whole system knowledge or a server component.

To parallelize the waterfall you need whole system knowledge, so you probably need a runtime which hooks into import(). A Server-Side api would also work.

In general I like that MF doesn't depend on additional server side components and is only static assets. This simplifies the required infrastructure.

I also like that in MF each build can be deployed separately from others without extra step to generate something with whole system knowledge. This might be useful when one build is deployed by a 3rd party and you don't know when it's deployed.

ScriptedAlchemy

comment created time in a day

push eventwebpack/webpack.js.org

Travis CI

commit sha fb0f232d2d8e1a7258ff69eceee677448634aef0

Updates

view details

push time in a day

push eventwebpack/webpack.js.org

Travis CI

commit sha f56dc44008a4013d2cd7a6861092fde44521fe2a

Updates

view details

push time in a day

push eventwebpack/webpack

Tobias Koppers

commit sha cf721a4ab0f9b76052ce10e2e73349280f57dac7

fix watch test case

view details

push time in 2 days

issue commentwebpack/webpack

Module sharing supporting semver ranges including prereleases

So it was a bit more involved but I'm done: https://github.com/webpack/webpack/pull/11105

This adds full SemVer support for any kind of range and complex versions like 1.2.3-beta.42+123.456. Afaik it should behave equal to the semver specification including edge cases like prereleases doesn't match normal ranges, prereleases are smaller than the final release, etc.

jasongrout

comment created time in 2 days

push eventwebpack/webpack

Tobias Koppers

commit sha 13961a17e212185319ba970d85666568dcbafb83

a little more defensive in the chunk loading runtime code to avoid crashes

view details

push time in 2 days

PR opened webpack/webpack

add full Semantic Versioning for Shared Modules
  • change storage format in the share scope
    • We have to lift the limitation of having only one version per version position, as complex ranges could select lower versions
    • Instead we walk through all version available while consuming to find the highest in range
  • choose shared module deterministic from the same origin
    • output.uniqueName is used as second criteria if multiple builds provide the same version
    • This improves long term caching as used shared module do no longer depend on a race condition
  • remove array syntax from version and requiredVersion in schema
    • The new internal format is too complex for the user to provide
    • And we want to have the option to change this later

Version are encoding this way:

1.2.3 => [1,2,3]
1.2.3-beta.42 => [1,2,3,,"beta",42]
1.2.3.4.5+55.66 => [1,2,3,4,5,[],55,66]
1.alternative-beta.42+55.66 => [1,"alternative",,"beta",42,[],55,66]

This format allows easy walking and decision based on typeof item. The duplicate ,, is intentional and creates a hole, which is typeof undefined, but very short to print^^

The format is SemVer compatible but less restrictive. We allow more and less version numbers. We allow strings as version numbers (might be useful for a/b tests). We do not apply additional restrictions on the possible chars.

Ranges are encoding this way:

Simple ranges
1.2.3, v1.2.3, =1.2.3 => [4,1,2,3] (4 fixed positions, 1,2,3 is the version
>=1.2.3 => [0,1,2,3]
^1.2.3 => [1,1,2,3]
^0.2.3 => [2,0,2,3]
^0.0.3 => [3,0,0,3]
<1.2.3 => [-1,1,2,3] (negative changes direction)
5, 5.x, 5.*, 5.X, 5.x.x, ... => [1,5]
9.8, 9.8.*, ... => [2,9,8]

Complex ranges
(They compile to a little program, executing simple ranges and operations on a stack)
(Complex ranges are identified by starting with a hole (!(0 in range)))
^4 || ^5 => [,[1,5],[1,4],1] (1 is the operation for OR)
>=2 <3 => [,[-1,3],[0,2],2] (2 is the operation for AND)
>1.2.3 => (>=1.2.3 not(1.2.3)) => [,[4,1,2,3],0,[0,1,2,3],2] (0 is the operation of NOT)
<=1.2.3 => [,[4,1,2,3],[-1,1,2,3],1]
1.2.3 - 3.2.1 => (>=1.2.3 <=3.2.1) => [,[4,3,2,1],[-1,3,2,1],1,[0,1,2,3],1]

The range encoding is only used webpack internal.

The version encoding is part of the Module Federation API

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> <!-- Explain the motivation for making this change. What existing problem does the pull request solve? --> <!-- Try to link to an open issue for more information. -->

<!-- In addition to that please answer these questions: -->

What kind of change does this PR introduce? feature <!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->

Did you add tests for your changes? yes <!-- Note that we won't merge your changes if you don't add tests -->

Does this PR introduce a breaking change? yes (containers are not compatible to previous beta versions) <!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

What needs to be documented once your changes are merged? The semver limitation can be removed. <!-- List all the information that needs to be added to the documentation after merge --> <!-- When your changes are merged you will be asked to contribute this to the documentation -->

+1744 -866

0 comment

33 changed files

pr created time in 2 days

issue commentwebpack/webpack

copy only, prevent bundle and binary asset corruption

The problem is this context [./ sync recursive (?<!\bApp_Resources\b.*)(?<!\.\/\btests\b\/.*?)\.(xml|css|js|kt|(?<!\.d\.)ts|(?<!\b_[\w-]*\.)scss)$] . sync (?<!\bApp_Resources\b.*)(?<!\.\/\btests\b\/.*?)\.(xml|css|js|kt|(?<!\.d\.)ts|(?<!\b_[\w-]*\.)scss)$ 534 bytes {bundle} [built]. It includes all files matching this regexp. Probably added by something nativescript specific.

You could try --display-reasons to get more info.

ray007

comment created time in 2 days

create barnchwebpack/webpack

branch : mf/semver

created branch time in 2 days

Pull request review commentvercel/next.js

Use single webpack runtimeChunk for Node.js compilation

 export type OriginalStackFrameResponse = {  type Source = { map: () => RawSourceMap } | null +const isWebpack5 = parseInt(webpack.version!) === 5++function getModuleSource(compilation: any, module: any): any {+  if (isWebpack5) {+    return (+      compilation.codeGenerationResults.get(module).sources.get('javascript') ??
      module && compilation.codeGenerationResults.get(module)?.sources.get('javascript') ??
timneutkens

comment created time in 2 days

pull request commentwebpack/webpack.js.org

Remove Google Analytics

I don't think we can accept a git depenency to an external server as dependency. I understand your fight against MS, but I don't think this applies to the webpack project. We already heavily depend on GitHub and npm.

I don't think it's a good idea to start depending on non-github/npm dependencies for consistency, versioning and stability reasons. So please either publish that to npm or, if you don't want to (which is totally fine, no blame here), maybe someone else could fork it to GitHub and publish to npm.

Unrelated from that:

Make sure to version your package. Create version tag. Increase version in package.json. changelog/release notes. Yarn caches git depenendencies based on version, so it behaves really weird when not versioning correctly.

I saw you fork the package from react-g-analytics and changed it to plausible. That's fine, but what's not ok (and could get you in trouble) is that you changed the copyright to your own name, overwriting the original author. That's basically stealing the code, even if it's MIT. The only requirement in MIT licence is to keep the copyright note.

resynth1943

comment created time in 3 days

issue commentwebpack/webpack

Can't find options with ident 'ref--*-*' when Rule.use is a function

Webpack 5 has a better error message for this case. It also fixes some problems here. Anyway you need an ident When using a function. ident should be next to options not inside of the options. { loader, options, ident }

melan0802

comment created time in 3 days

issue commentwebpack/webpack

Webpack analyses dependencies tree before applying webpack.DefinePlugin variables and minimizing code

Actually that should work... Could you provide a repro?

budarin

comment created time in 3 days

issue commentwebpack/webpack

Webpack 5 Beta 19: Invalid postinstall

The intention of this script was only for local development. It was never intended to run that on user-side.

arcanis

comment created time in 3 days

issue closedwebpack/webpack

Webpack 5 Beta 19: Invalid postinstall

Bug report

The postinstall script applied on #10929 causes Webpack 5 to fail installs (technically because is-ci and yarn-deduplicate are dev deps, but the real problem is that this script shouldn't exist in the first place).

If the current behavior is a bug, please provide the steps to reproduce.

Just install Webpack 5. The problem got detected by our automated tests a few minutes ago:

https://github.com/yarnpkg/berry/runs/819104587

Other relevant information:

I suggest just removing the postinstall script, since its value is fairly low. If you really need this feature, perhaps we can look into upgrading your repository to Yarn 2 and implement the deduplication as a plugin? Babel recently did it, and Jest is almost done as well, so it probably won't be much more difficult.

closed time in 3 days

arcanis

issue commentwebpack/webpack

Webpack 5 Beta 19: Invalid postinstall

fixed in https://github.com/webpack/webpack/releases/tag/v5.0.0-beta.20

arcanis

comment created time in 3 days

release webpack/webpack

v5.0.0-beta.20

released time in 3 days

created tagwebpack/webpack

tagv5.0.0-beta.20

A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.

created time in 3 days

push eventwebpack/webpack

Tobias Koppers

commit sha 8efea230e05561fbaf3f9872e01affcac399cb3a

5.0.0-beta.20

view details

push time in 3 days

push eventwebpack/webpack

Tobias Koppers

commit sha c2b163588cbdd29eb6432aa8dd1b19d54898af57

remove broken postinstall

view details

push time in 3 days

release webpack/webpack

v5.0.0-beta.19

released time in 3 days

created tagwebpack/webpack

tagv5.0.0-beta.19

A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.

created time in 3 days

push eventwebpack/webpack

Tobias Koppers

commit sha 3347fa1cee621c7f684b25507fdaed3264e8dcd9

5.0.0-beta.19

view details

push time in 3 days

PR merged webpack/webpack

rename jsonScriptType to scriptType PR: CI-ok PR: reviewed-approved PR: tests-needed

Closes this card

What kind of change does this PR introduce?

refactoring

Did you add tests for your changes?

just updated snapshots

Does this PR introduce a breaking change?

no, the option was introduced in webpack 5

What needs to be documented once your changes are merged?

about the option

+63 -71

2 comments

9 changed files

smelukov

pr closed time in 3 days

pull request commentwebpack/webpack

rename jsonScriptType to scriptType

Thanks

smelukov

comment created time in 3 days

push eventwebpack/webpack

Sergey Melyukov

commit sha 139da61b5fad15227a95f72d36943cf1b7ed5ca7

rename jsonScriptType to scriptType

view details

Tobias Koppers

commit sha 204e104bc249c606bd01c32b5c1c15681ece1ab1

Merge pull request #11084 from smelukov/rename-json-script-type rename jsonScriptType to scriptType

view details

push time in 3 days

push eventwebpack/webpack

Tobias Koppers

commit sha 9f28e37969db7c22ba2132fb10721e0bd8f961fe

allow runtimeChunk with node targets also fixes a incorrect relative path

view details

Tobias Koppers

commit sha e851d2322ade0ba56d4420c7518e31736c2b1cbd

Merge pull request #11098 from webpack/bugfix/runtime-chunk-node allow runtimeChunk with node targets

view details

push time in 3 days

delete branch webpack/webpack

delete branch : bugfix/runtime-chunk-node

delete time in 3 days

PR merged webpack/webpack

allow runtimeChunk with node targets PR: CI-ok PR: unreviewed

also fixes a incorrect relative path

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> <!-- Explain the motivation for making this change. What existing problem does the pull request solve? --> <!-- Try to link to an open issue for more information. -->

<!-- In addition to that please answer these questions: -->

What kind of change does this PR introduce? bugfix <!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->

Did you add tests for your changes? yes <!-- Note that we won't merge your changes if you don't add tests -->

Does this PR introduce a breaking change? only compared to prev betas. for custom targets using NodeTemplatePlugin or WebWorkerTemplatePlugin, this uses StartupChunkDependenciesPlugin by default. <!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

What needs to be documented once your changes are merged? nothing <!-- List all the information that needs to be added to the documentation after merge --> <!-- When your changes are merged you will be asked to contribute this to the documentation -->

+459 -123

2 comments

22 changed files

sokra

pr closed time in 3 days

PR opened webpack/webpack

allow runtimeChunk with node targets

also fixes a incorrect relative path

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> <!-- Explain the motivation for making this change. What existing problem does the pull request solve? --> <!-- Try to link to an open issue for more information. -->

<!-- In addition to that please answer these questions: -->

What kind of change does this PR introduce? bugfix <!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->

Did you add tests for your changes? yes <!-- Note that we won't merge your changes if you don't add tests -->

Does this PR introduce a breaking change? only compared to prev betas. for custom targets using NodeTemplatePlugin or WebWorkerTemplatePlugin, this uses StartupChunkDependenciesPlugin by default. <!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

What needs to be documented once your changes are merged? nothing <!-- List all the information that needs to be added to the documentation after merge --> <!-- When your changes are merged you will be asked to contribute this to the documentation -->

+459 -123

0 comment

22 changed files

pr created time in 3 days

create barnchwebpack/webpack

branch : bugfix/runtime-chunk-node

created branch time in 3 days

issue commentwebpack/webpack

Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

Ok if you are on .17 it's not the issue. The bug I was talking about is only in .18. But try anyway^^

ScriptedAlchemy

comment created time in 5 days

issue commentwebpack/webpack

Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

@jablonnc could you try using the master branch? Sounds like the bug I have already fixed.

@ScriptedAlchemy check if you are using the correct remoteType. It defaults to "script" but only if you haven't specified a library. Best omit library anyway.

ScriptedAlchemy

comment created time in 5 days

push eventsokra/slides

Tobias Koppers

commit sha 9f2165d46696c57c6bd008b35d20b8b475d6d151

add webpack 5 Miniseries

view details

push time in 6 days

Pull request review commentwebpack/webpack

Support url requests

 const asBuffer = input => { 	return input; }; -const readResourceFn = fs => {-	return (resource, callback) => {-		const decodedData = decodeDataURI(resource);--		if (decodedData) {-			process.nextTick(() => {-				callback(null, decodedData);-			});-			return;+/**+ * @param {InputFileSystem} fs fs+ * @param {string|undefined} scheme scheme+ * @returns {(resource: string, cb: (err: Error|null, data?: string|Buffer) => void) => void} read function+ */+const readResourceFn = (fs, scheme) => {+	if (scheme) {+		switch (scheme) {+			case "data":+				return (resource, callback) => {+					process.nextTick(() => {+						callback(null, decodeDataURI(resource));+					});+				};+			case "file":+				return (resource, callback) => {+					//@ts-expect-error TODO add URL path support to CachedInputFileSystem+					fs.readFile(new URL(resource), callback);

Use https://nodejs.org/api/url.html#url_url_fileurltopath_url to convert it back to a path.

vankop

comment created time in 6 days

Pull request review commentwebpack/webpack

Support url requests

 const asBuffer = input => { 	return input; }; -const readResourceFn = fs => {-	return (resource, callback) => {-		const decodedData = decodeDataURI(resource);--		if (decodedData) {-			process.nextTick(() => {-				callback(null, decodedData);-			});-			return;+/**+ * @param {InputFileSystem} fs fs+ * @param {string|undefined} scheme scheme+ * @returns {(resource: string, cb: (err: Error|null, data?: string|Buffer) => void) => void} read function+ */+const readResourceFn = (fs, scheme) => {

loaders could potentially change the resource in pitch mode. So you better parse the schema again and don't take it from before.

vankop

comment created time in 6 days

issue commentwebpack/webpack

disable minification for child compilers

And we should set skipOptimization on assets from children so they are not mininized twice...

jantimon

comment created time in 7 days

issue commentwebpack/webpack

disable minification for child compilers

If they are copied yes, but e. g. worker-loader can also inline the worker code as data uri or blob. That code would be not optimized in this case.

jantimon

comment created time in 7 days

Pull request review commentwebpack/webpack.js.org

Remove Google Analytics

     "react-banner": "^1.0.0-rc.0",     "react-document-title": "^2.0.3",     "react-dom": "^16.8.6",-    "react-g-analytics": "0.4.2",     "react-hot-loader": "^4.0.0-beta.12",     "react-markdown": "4.2.2",+    "react-plausible-analytics": "git+https://codeberg.org/resynth1943/react-plausible-analytics.git#master",

Should be published to npm

resynth1943

comment created time in 7 days

pull request commentwebpack/webpack.js.org

Remove Google Analytics

Shouldn't there be an update to the yarn.lock file...?

resynth1943

comment created time in 7 days

issue commentwebpack/webpack

disable minification for child compilers

Hmm maybe not. What's about worker-loader or other plugins that create webworkers. They want their worker code, which is build in a child compilation, to be optimized. Less relevant if they emit a worker as file, but at least worker-loader can also create a worker as data URL.

I would go with a skipOptimization flag...

jantimon

comment created time in 7 days

issue commentwebpack/webpack

Module sharing supporting semver ranges including prereleases

@jasongrout I'll implement it for you...

jasongrout

comment created time in 7 days

issue commentwebpack/webpack

Webpack 5: Empty JS chunks are emitted for CSS entries

Webpack 5 would not emit chunks without modules. I think in this case there is a js module in the chunk which is empty and the output file gets empty after minimizing.

Once we upgrade the mini css extract plugin to webpack 5 we can do a lot improvements, like getting rid of these empty js modules.

slightlyfaulty

comment created time in 7 days

pull request commentwebpack/webpack

fix: some typos

Thanks

snitin315

comment created time in 7 days

push eventwebpack/webpack

Nitin Kumar

commit sha 609fb4c5d9cc8bb7a20c16ed4df9a64e91817332

fix: typos in module-fedaration example

view details

Nitin Kumar

commit sha 9bc6903ffc686742e93ec17f64049a48655483b7

fix: typos in container-entry-overridables test

view details

Tobias Koppers

commit sha ffcae03680ae174ade4b325637cb5edf7b6e1603

Merge pull request #11078 from snitin315/fix/typos fix: some typos

view details

push time in 7 days

PR merged webpack/webpack

fix: some typos PR: CI-ok PR: reviewed-approved

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> <!-- Explain the motivation for making this change. What existing problem does the pull request solve? --> <!-- Try to link to an open issue for more information. -->

<!-- In addition to that please answer these questions: -->

What kind of change does this PR introduce? typo fix <!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->

Did you add tests for your changes? NA <!-- Note that we won't merge your changes if you don't add tests -->

Does this PR introduce a breaking change? no <!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

What needs to be documented once your changes are merged? nothing <!-- List all the information that needs to be added to the documentation after merge --> <!-- When your changes are merged you will be asked to contribute this to the documentation -->

+4 -4

2 comments

3 changed files

snitin315

pr closed time in 7 days

push eventwebpack/webpack

Tobias Koppers

commit sha b15a2e23f1c432add9fd84b13046d36cc00ef031

add test case

view details

Tobias Koppers

commit sha 8ca593e71828f36e582c38b3c6e83234907a003c

only use chunks with js for entry deferring code

view details

Tobias Koppers

commit sha 5966c2d26f0ea31ac9fee8588bc9ec76ad30d970

update snapshots

view details

Tobias Koppers

commit sha b8fb159844e59652eb65a99130cf2c44d96bcf04

Merge pull request #11086 from webpack/bugfix/non-js-chunk-entrypoint add support for non-js chunks in entrypoints

view details

push time in 7 days

delete branch webpack/webpack

delete branch : bugfix/non-js-chunk-entrypoint

delete time in 7 days

PR merged webpack/webpack

add support for non-js chunks in entrypoints PR: CI-ok PR: unreviewed

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> <!-- Explain the motivation for making this change. What existing problem does the pull request solve? --> <!-- Try to link to an open issue for more information. -->

<!-- In addition to that please answer these questions: -->

What kind of change does this PR introduce? bugfix <!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->

Did you add tests for your changes? yes <!-- Note that we won't merge your changes if you don't add tests -->

Does this PR introduce a breaking change? no <!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

What needs to be documented once your changes are merged? nothing <!-- List all the information that needs to be added to the documentation after merge --> <!-- When your changes are merged you will be asked to contribute this to the documentation -->

+83 -22

2 comments

11 changed files

sokra

pr closed time in 7 days

Pull request review commentwebpack/webpack

fix: multiple calls close watcher

 class Watching { 		this.handler = handler; 		/** @type {Callback<void>[]} */ 		this.callbacks = [];+		/** @type {Callback<void>[]} */+		this.closeCallbacks = [];
		this._closeCallbacks = [];

make it private

xiaoxiaojx

comment created time in 7 days

Pull request review commentwebpack/webpack

fix: multiple calls close watcher

+"use strict";++const path = require("path");++const webpack = require("../");++describe("WatchClose", () => {+	jest.setTimeout(5000);++	describe("multiple calls watcher", () => {+		const fixturePath = path.join(__dirname, "fixtures");+		const filePath = path.join(fixturePath, "a.js");++		let compiler = webpack({+			mode: "development",+			entry: filePath,+			output: {+				path: fixturePath,+				filename: "bundle.js"+			}+		});+		const watcher = compiler.watch({+			poll: 300+		});++		afterAll(() => {+			compiler = null;+		});++		function close(watcher, callback) {+			return new Promise(res => {+				const onClose = () => {+					callback();+					res();+				};+				watcher.close(onClose);+			});+		}++		it("each callback should be called", async done => {+			let num = 0;++			await close(watcher, () => {+				num += 1;+			});+			expect(num).toBe(1);+			await close(watcher, () => {+				num += 1;+			});++			expect(num).toBe(2);++			done();+		});++		it("each callback should be called", async done => {+			let num = 0;++			await new Promise(res => {+				watcher.close(() => {+					if (num === 1) {+						res();+					} else {+						num += 1;+					}+				});+				watcher.close(() => {+					if (num === 1) {+						res();+					} else {+						num += 1;+					}+				});+			});++			expect(num).toBe(1);

It might be simpler to

			await Promise.all([
				close(watcher, () => num += 1)
				close(watcher, () => num += 10)
			});
			
			expect(num).toBe(11);
xiaoxiaojx

comment created time in 7 days

Pull request review commentwebpack/webpack

fix: multiple calls close watcher

+"use strict";++const path = require("path");++const webpack = require("../");++describe("WatchClose", () => {+	jest.setTimeout(5000);++	describe("multiple calls watcher", () => {+		const fixturePath = path.join(__dirname, "fixtures");+		const filePath = path.join(fixturePath, "a.js");++		let compiler = webpack({+			mode: "development",+			entry: filePath,+			output: {+				path: fixturePath,+				filename: "bundle.js"+			}+		});+		const watcher = compiler.watch({+			poll: 300+		});++		afterAll(() => {+			compiler = null;+		});

Initialization should be wrapped in a beforeEach

and afterAll -> afterEach

xiaoxiaojx

comment created time in 7 days

push eventwebpack/webpack

Tobias Koppers

commit sha 4deb38487202a2f1da771952bbb2f070193553d7

join asset info flags correctly

view details

Tobias Koppers

commit sha 1b5fecbe5f8fc93e02f92c494224d7b8f0b2ab05

Merge pull request #11087 from webpack/bugfix/print-asset-info join asset info flags correctly

view details

push time in 7 days

delete branch webpack/webpack

delete branch : bugfix/print-asset-info

delete time in 7 days

PR merged webpack/webpack

join asset info flags correctly PR: CI-ok PR: unreviewed

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> <!-- Explain the motivation for making this change. What existing problem does the pull request solve? --> <!-- Try to link to an open issue for more information. -->

<!-- In addition to that please answer these questions: -->

What kind of change does this PR introduce? bugfix <!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->

Did you add tests for your changes? yes <!-- Note that we won't merge your changes if you don't add tests -->

Does this PR introduce a breaking change? no <!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

What needs to be documented once your changes are merged? nothing <!-- List all the information that needs to be added to the documentation after merge --> <!-- When your changes are merged you will be asked to contribute this to the documentation -->

+1 -0

2 comments

1 changed file

sokra

pr closed time in 7 days

push eventwebpack/webpack

Nitin Kumar

commit sha 56d3950225ce672785361412b31a8cf08bf0c9d4

feat: return preset normal for stats true

view details

Nitin Kumar

commit sha e374ab15827ae7a914c6387feff0f8d4a8a998b9

tests: add tests for stats true

view details

Nitin Kumar

commit sha f6c8039c5a993f54a7864f4c918e0d70db104290

tests: add test for stats false

view details

Nitin Kumar

commit sha 9103c89838005bc076f448c33582a3786bd7ce4e

tests: add test for stats string

view details

Tobias Koppers

commit sha 75bf091f0f431de0a5f8286e102ec7d6f040905e

Merge pull request #11090 from snitin315/feat/stats return preset normal for stats true

view details

push time in 7 days

pull request commentwebpack/webpack

return preset normal for stats true

Thanks

snitin315

comment created time in 7 days

PR merged webpack/webpack

return preset normal for stats true PR: CI-ok PR: reviewed-approved PR: tests-needed

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> <!-- Explain the motivation for making this change. What existing problem does the pull request solve? --> <!-- Try to link to an open issue for more information. -->

<!-- In addition to that please answer these questions: -->

What kind of change does this PR introduce? closes #11072 <!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->

Did you add tests for your changes?

<!-- Note that we won't merge your changes if you don't add tests -->

Does this PR introduce a breaking change?

<!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

What needs to be documented once your changes are merged?

<!-- List all the information that needs to be added to the documentation after a merge --> <!-- When your changes are merged you will be asked to contribute this to the documentation -->

+42 -1

3 comments

2 changed files

snitin315

pr closed time in 7 days

issue closedwebpack/webpack

bug: option stats is not compiling value true correctly

<!-- Please don't delete this template because we'll close your issue --> <!-- Before creating an issue please make sure you are using the latest version of webpack. -->

Bug report

stats: true is actually doing nothing

What is the current behavior? for stats: true in webpack config, compiler.options.stats = {}. where as for stats: false it's correct compiter.options.stats = { preset: 'none'}

for stats: true -

Screenshot at 2020-06-22 18-09-37

for stats: false

Screenshot at 2020-06-22 18-09-09

If the current behavior is a bug, please provide the steps to reproduce. set stats: true in webpack config and then check the value of stats in the compiler.options

<!-- A great way to do this is to provide your configuration via a GitHub repository --> <!-- The most helpful is a minimal reproduction with instructions on how to reproduce --> <!-- Repositories with too many files or large webpack.config.js files are not suitable --> <!-- Please only add small code snippets directly into this issue --> <!-- https://gist.github.com is a good place for longer code snippets --> <!-- If your issue is caused by a plugin or loader, please create an issue on the loader/plugin repository instead -->

What is the expected behavior? stats: true should set compiler.options.stats : {preset : 'normal'}.

<!-- "It should work" is not a helpful explanation --> <!-- Explain exactly how it should behave -->

Other relevant information: webpack version: 5 Node.js version: 12.16.2

closed time in 7 days

snitin315

Pull request review commentwebpack/webpack

Prefetch + Container Reference test

+// This config need to be set on initial evaluation to be effective+__webpack_nonce__ = "nonce";++it("should prefetch the remote async module", () => {+	__non_webpack_require__("./host-entry.js");++	expect(document.head._children.length).toBe(0);++	return import(/* webpackChunkName: "host-entry" */ "./host-entry")+		.then(module => module.getRemoteModule())+		.then(module => {+			expect(module.default).toBe('remote ./async-module');+			expect(document.head._children.length).toBe(1);++			const link = document.head._children[0];+			expect(link._type).toBe("link");+			expect(link.rel).toBe("prefetch");+			expect(link.as).toBe("script");++			/**+			 * What should this be....?+			 */+			expect(link.href).toBe("remote/async-module.js");

No not this way. Adding the prefetch tag would be delegated to the container, but the container is simulated here. It would make sense to compile a real container in a separate test case to get the full Workflow. Check the test cases that start with numbers to see how to write two test cases that work together. E.g. 1-container-full

ethersage

comment created time in 7 days

issue commentwebpack/webpack

disable minification for child compilers

I think it makes sense to add this kind of info to the asset info data as flag. The terser plugin could skip asset flagged this way.

jantimon

comment created time in 7 days

issue commentwebpack/webpack

CommonJS exports without namespace when libraryTarget=umd

exports = factory();

That doesn't work. You must modify the object.

Pure CommonJS without module is pretty rare anyway. You won't see it in any popular tool/environment.

kirill-konshin

comment created time in 7 days

delete branch webpack/webpack

delete branch : bugfix/provide-in-watch

delete time in 7 days

push eventwebpack/webpack

Tobias Koppers

commit sha da3685274f8c8095fadca82650a7053505280afc

add test case

view details

Tobias Koppers

commit sha b30b9681fa49059a5abe38da94b7706949b3bf5d

opt-out from unsafe caching when providing shared module as side-effect

view details

Tobias Koppers

commit sha 79f369403458ac4524cd24f3645195374c5b2f72

fix casing in ProvideSharedPlugin

view details

Tobias Koppers

commit sha 80b76711f97b7a474a38ce6d7a643eb1e5398273

Merge pull request #11085 from webpack/bugfix/provide-in-watch fix missing provide module in incremental build

view details

push time in 7 days

PR merged webpack/webpack

fix missing provide module in incremental build PR: CI-ok PR: unreviewed

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> <!-- Explain the motivation for making this change. What existing problem does the pull request solve? --> <!-- Try to link to an open issue for more information. -->

<!-- In addition to that please answer these questions: -->

What kind of change does this PR introduce? bugfix <!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->

Did you add tests for your changes? yes <!-- Note that we won't merge your changes if you don't add tests -->

Does this PR introduce a breaking change? no <!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

What needs to be documented once your changes are merged? nothing <!-- List all the information that needs to be added to the documentation after merge --> <!-- When your changes are merged you will be asked to contribute this to the documentation -->

+47 -6

2 comments

9 changed files

sokra

pr closed time in 7 days

issue commentwebpack/webpack

TS type for Entry error

You could try that:

-entry: ['webpack-hot-middleware/client', path.join(__dirname, '..', 'client', 'index.jsx')],
+entry: ['webpack-hot-middleware/client', path.join(__dirname, '..', 'client', 'index.jsx')] as const,
ebuchmann

comment created time in 8 days

issue commentwebpack/webpack

bug: option stats is not compiling value true correctly

@sokra it is hard for plugins/external tools, to detect alias, why do not create alias stats: true === stats: 'normal',stats: false-stats: 'none'`?

I'm fine with that, send a PR.

So there is no bug here...

snitin315

comment created time in 8 days

issue commentwebpack/webpack

Wrong relative path when using `externals`

That's outside of the scope of the externals feature. You would have to handle this in the function you provided for externals.

Why not using const _add = require("lodash/add");?

malash

comment created time in 8 days

push eventwebpack/webpack

Tobias Koppers

commit sha 5966c2d26f0ea31ac9fee8588bc9ec76ad30d970

update snapshots

view details

push time in 8 days

issue commentwebpack/webpack

Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

https://github.com/webpack/webpack/pull/11085 https://github.com/webpack/webpack/pull/11086

ScriptedAlchemy

comment created time in 8 days

PR opened webpack/webpack

join asset info flags correctly

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> <!-- Explain the motivation for making this change. What existing problem does the pull request solve? --> <!-- Try to link to an open issue for more information. -->

<!-- In addition to that please answer these questions: -->

What kind of change does this PR introduce? bugfix <!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->

Did you add tests for your changes? yes <!-- Note that we won't merge your changes if you don't add tests -->

Does this PR introduce a breaking change? no <!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

What needs to be documented once your changes are merged? nothing <!-- List all the information that needs to be added to the documentation after merge --> <!-- When your changes are merged you will be asked to contribute this to the documentation -->

+1 -0

0 comment

1 changed file

pr created time in 8 days

PR opened webpack/webpack

add support for non-js chunks in entrypoints

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> <!-- Explain the motivation for making this change. What existing problem does the pull request solve? --> <!-- Try to link to an open issue for more information. -->

<!-- In addition to that please answer these questions: -->

What kind of change does this PR introduce? bugfix <!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->

Did you add tests for your changes? yes <!-- Note that we won't merge your changes if you don't add tests -->

Does this PR introduce a breaking change? no <!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

What needs to be documented once your changes are merged? nothing <!-- List all the information that needs to be added to the documentation after merge --> <!-- When your changes are merged you will be asked to contribute this to the documentation -->

+72 -11

0 comment

10 changed files

pr created time in 8 days

create barnchwebpack/webpack

branch : bugfix/print-asset-info

created branch time in 8 days

create barnchwebpack/webpack

branch : bugfix/non-js-chunk-entrypoint

created branch time in 8 days

push eventwebpack/webpack

Tobias Koppers

commit sha b30b9681fa49059a5abe38da94b7706949b3bf5d

opt-out from unsafe caching when providing shared module as side-effect

view details

Tobias Koppers

commit sha 79f369403458ac4524cd24f3645195374c5b2f72

fix casing in ProvideSharedPlugin

view details

push time in 8 days

PR opened webpack/webpack

fix missing provide module in incremental build

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> <!-- Explain the motivation for making this change. What existing problem does the pull request solve? --> <!-- Try to link to an open issue for more information. -->

<!-- In addition to that please answer these questions: -->

What kind of change does this PR introduce? bugfix <!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->

Did you add tests for your changes? yes <!-- Note that we won't merge your changes if you don't add tests -->

Does this PR introduce a breaking change? no <!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->

What needs to be documented once your changes are merged? nothing <!-- List all the information that needs to be added to the documentation after merge --> <!-- When your changes are merged you will be asked to contribute this to the documentation -->

+42 -6

0 comment

8 changed files

pr created time in 8 days

create barnchwebpack/webpack

branch : bugfix/provide-in-watch

created branch time in 8 days

pull request commentwebpack/webpack.js.org

Remove Google Analytics

<script async defer data-domain="webpack.js.org" src="https://plausible.io/js/plausible.js"></script>
resynth1943

comment created time in 8 days

issue commentwebpack/webpack

v5 module dep invalidation not working in cases that do in v4

button.css!=!some-loader!b64-decode?content=asfsa!

This should be interpreted like The result of some-loader!b64-decode?content=asfsa! is processed like it it was written in a file named button.css. So the result should be CSS as you would write CSS in a .css file. All loaders and other rules from the config that would match a button.css file are used on the result.

jquense

comment created time in 8 days

issue commentwebpack/webpack

v5 module dep invalidation not working in cases that do in v4

It's a special inline syntax (that should only be used by loaders).

No this would build in a single compilation

jquense

comment created time in 8 days

issue commentwebpack/webpack

Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

No worries I have both bugs already fixed locally. Will push that soon.

ScriptedAlchemy

comment created time in 8 days

issue commentwebpack/webpack

Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

@NMinhNguyen seem to be a bug in the jsonp handling for chunks without js code

Ok it seem to be something else. Very weird that it only happens on second build. Enabled Persistent Caching would explain it, but it's not enabled...

Investigating further...

Ok there seem to be 2 bugs your repro.

  • chunks without js are not handled correctly. This causes the repro to break.
  • providing shared modules looses it's info when modules are unsafe cached by the NormalModuleFactory. This fixes the repro after a rebuild.
ScriptedAlchemy

comment created time in 8 days

issue commentwebpack/webpack

Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

@NMinhNguyen seem to be a bug in the jsonp handling for chunks without js code

Ok it seem to be something else. Very weird that it only happens on second build. Enabled Persistent Caching would explain it, but it's not enabled...

ScriptedAlchemy

comment created time in 8 days

Pull request review commentwebpack/webpack

add import.meta support

 import b from "./b";  export default b; -if(module.hot) {-	module.hot.decline("./b");-	module.hot.accept();+if(import.meta.hot) {

Keep the old test and create a new copy

vankop

comment created time in 8 days

Pull request review commentwebpack/webpack

add import.meta support

 it("should import a changed chunk", (done) => { 		}).catch(done); 	}).catch(done); });++it("should import a changed chunk using import.meta.hot.accept API", (done) => {

You can't put multiple tests in a hotCase. Create a new folder.

each NEXT goes to the next hmr update and there is no way back for the next test.

vankop

comment created time in 8 days

more