repo
stringlengths
5
106
file_url
stringlengths
78
301
file_path
stringlengths
4
211
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:56:49
2026-01-05 02:23:25
truncated
bool
2 classes
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/ecmaVersion/browserslist-config-env-extends/test.config.js
test/configCases/ecmaVersion/browserslist-config-env-extends/test.config.js
"use strict"; const fs = require("fs"); const path = require("path"); const rootPath = path.resolve(__dirname, "../../../../"); const rootNodeModules = path.resolve(rootPath, "./node_modules"); const browserslistPackage = path.resolve( rootNodeModules, "browserslist-config-mycompany" ); const content = ` module.exp...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/ecmaVersion/browserslist-config-env-extends/webpack.config.js
test/configCases/ecmaVersion/browserslist-config-env-extends/webpack.config.js
"use strict"; const path = require("path"); /** @type {import("../../../../").Configuration} */ module.exports = { target: `browserslist:${path.join(__dirname, ".browserslistrc")}:production`, plugins: [ (compiler) => { compiler.hooks.compilation.tap("Test", (compilation) => { expect(compilation.outputOpti...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/ecmaVersion/2015/index.js
test/configCases/ecmaVersion/2015/index.js
it("should compile and run the test", function() {});
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/ecmaVersion/2015/webpack.config.js
test/configCases/ecmaVersion/2015/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { target: ["node", "es2015"] };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/ecmaVersion/2020/index.js
test/configCases/ecmaVersion/2020/index.js
it("should compile and run the test", function() {});
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/ecmaVersion/2020/webpack.config.js
test/configCases/ecmaVersion/2020/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { target: ["node", "es2020"] };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/ecmaVersion/browserslist-config/index.js
test/configCases/ecmaVersion/browserslist-config/index.js
it("should compile and run the test", function() {});
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/ecmaVersion/browserslist-config/webpack.config.js
test/configCases/ecmaVersion/browserslist-config/webpack.config.js
"use strict"; const path = require("path"); /** @type {import("../../../../").Configuration} */ module.exports = { target: `browserslist:${path.join(__dirname, ".browserslistrc")}`, plugins: [ (compiler) => { compiler.hooks.compilation.tap("Test", (compilation) => { expect(compilation.outputOptions.environ...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/crossorigin/set-crossorigin/index.js
test/configCases/crossorigin/set-crossorigin/index.js
it("should load script without crossorigin attribute (default)", function() { const promise = import("./empty?a" /* webpackChunkName: "crossorigin-default" */); var script = document.head._children.pop(); __non_webpack_require__("./crossorigin-default.web.js"); expect(script.src).toBe("https://test.cases/path/cros...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/crossorigin/set-crossorigin/empty.js
test/configCases/crossorigin/set-crossorigin/empty.js
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/crossorigin/set-crossorigin/webpack.config.js
test/configCases/crossorigin/set-crossorigin/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", output: { chunkFilename: "[name].web.js", crossOriginLoading: "anonymous" }, performance: { hints: false }, optimization: { minimize: false }, experiments: { css: true } };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/types/filesystems/test.filter.js
test/configCases/types/filesystems/test.filter.js
"use strict"; module.exports = () => false;
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/types/filesystems/webpack.config.js
test/configCases/types/filesystems/webpack.config.js
"use strict"; const fs = require("fs"); const memfs = require("memfs"); /** @type {import("../../../../").Configuration} */ module.exports = { plugins: [ (compiler) => { // eslint-disable-next-line no-warning-comments // @ts-ignore compiler.outputFileSystem = memfs.fs; // eslint-disable-next-line no-wa...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/additional-pass/simple/index.js
test/configCases/additional-pass/simple/index.js
it("should compile", function(done) { done(); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/additional-pass/simple/webpack.config.js
test/configCases/additional-pass/simple/webpack.config.js
"use strict"; /** @type {import("../../../../").WebpackPluginFunction} */ function testPlugin() { let counter = 1; this.hooks.compilation.tap("TestPlugin", (compilation) => { const nr = counter++; compilation.hooks.needAdditionalPass.tap("TestPlugin", () => { if (nr < 5) return true; }); }); } /** @type {...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/delete-asset/index.js
test/configCases/assets/delete-asset/index.js
/**! Main */ it("should fail loading a deleted asset", async () => { await expect(import("./chunk.js")).rejects.toEqual( expect.objectContaining({ code: "ENOENT" }) ); await expect(import("./chunk2.js")).rejects.toEqual( expect.objectContaining({ code: "ENOENT" }) ); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/delete-asset/chunk.js
test/configCases/assets/delete-asset/chunk.js
/**! Chunk */ console.log("Fail");
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/delete-asset/chunk2.js
test/configCases/assets/delete-asset/chunk2.js
/**! Chunk */ console.log("Fail");
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/delete-asset/infrastructure-log.js
test/configCases/assets/delete-asset/infrastructure-log.js
"use strict"; module.exports = [ // each time sets different assetsInfo object instance in webpack.config.js:54 // this prevents hit in inmemory cache /^Pack got invalid because of write to: TerserWebpackPlugin|bundle0\.js$/ ];
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/delete-asset/webpack.config.js
test/configCases/assets/delete-asset/webpack.config.js
"use strict"; const TerserPlugin = require("terser-webpack-plugin"); const { BannerPlugin, Compilation } = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { minimize: true, minimizer: [ new TerserPlugin({ extractComments: { filename: "LICE...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/compression-webpack-plugin-issues-390/index.js
test/configCases/assets/compression-webpack-plugin-issues-390/index.js
/**! Main */ it("should handle asset deletion correctly during compression", async () => { const { default: add } = await import("./chunk.js"); expect(add(1, 2)).toBe(3); }); it("should not fail when accessing compressed assets", async () => { await expect(import("./chunk.js")).resolves.toBeDefined(); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/compression-webpack-plugin-issues-390/chunk.js
test/configCases/assets/compression-webpack-plugin-issues-390/chunk.js
export default function add(a, b) { return a + b; }
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/compression-webpack-plugin-issues-390/webpack.config.js
test/configCases/assets/compression-webpack-plugin-issues-390/webpack.config.js
"use strict"; const { Compilation } = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { plugins: [ (compiler) => { compiler.hooks.compilation.tap( "MockWebpackManifestPlugin", (compilation) => { compilation.hooks.processAssets.tap( { name: ...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/prevent-related-deletion/index.js
test/configCases/assets/prevent-related-deletion/index.js
const fs = require("fs") const path = require("path") try { import("./module.js"); } catch (_err) { // Nothing } it("should prevent related deletion", async () => { expect(fs.existsSync(path.join(__STATS__.outputPath, "module_js.bundle0.js"))).toBe(false); expect(fs.existsSync(path.join(__STATS__.outputPath, "mod...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/prevent-related-deletion/webpack.config.js
test/configCases/assets/prevent-related-deletion/webpack.config.js
"use strict"; const { Compilation } = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { target: "node", optimization: { minimize: true, chunkIds: "named" }, devtool: "source-map", plugins: [ (compiler) => { compiler.hooks.compilation.tap("Test", (compilation...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/prevent-related-deletion/module.js
test/configCases/assets/prevent-related-deletion/module.js
export default "module";
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/asset-emitted/index.js
test/configCases/assets/asset-emitted/index.js
it("should run", () => import("./module"));
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/asset-emitted/webpack.config.js
test/configCases/assets/asset-emitted/webpack.config.js
"use strict"; const Source = require("webpack-sources").Source; const Compilation = require("../../../../").Compilation; /** @type {import("../../../../").Configuration} */ module.exports = { plugins: [ (compiler) => { /** @type {Record<string, boolean>} */ const files = {}; compiler.hooks.assetEmitted.ta...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/assets/asset-emitted/module.js
test/configCases/assets/asset-emitted/module.js
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/emit/index.js
test/configCases/asset-modules/emit/index.js
import url from "../_images/file.png"; import url2 from "../_images/file.jpg"; import fs from "fs"; import path from "path"; it("should output asset with path", () => { expect(url).toEqual("images/file.png"); expect(url2).toEqual("images/file.jpg"); expect(fs.existsSync(path.join(__STATS__.outputPath, url))).toBe(...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/emit/webpack.config.js
test/configCases/asset-modules/emit/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", output: { assetModuleFilename: "images/file[ext]" }, module: { rules: [ { test: /\.png$/, type: "asset/resource", generator: { emit: false } }, { test: /\.jpg$/, type:...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/query-and-custom-encoder/index.js
test/configCases/asset-modules/query-and-custom-encoder/index.js
import png from "../_images/file.png"; import svg from "../_images/file.svg?foo=bar"; import jpg from "../_images/file.jpg"; it("should output various asset types", () => { expect(png).toMatch(/^data:image\/png;base64,[0-9a-zA-Z+/]+=*$/); expect(svg).toMatch(/^data:image\/svg\+xml,/); expect(jpg).toMatch(/^data:ima...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/query-and-custom-encoder/webpack.config.js
test/configCases/asset-modules/query-and-custom-encoder/webpack.config.js
"use strict"; const mimeTypes = require("mime-types"); const svgToMiniDataURI = require("mini-svg-data-uri"); /** @typedef {import("../../../../").GeneratorOptionsByModuleTypeKnown} GeneratorOptionsByModuleTypeKnown */ /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", modu...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/type-text/index.js
test/configCases/asset-modules/type-text/index.js
import svg from "../_images/file.svg" with { type: "text" }; it("should receive asset source", () => { expect(svg).toMatch(/^<svg.+<\/svg>\s*$/); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/type-text/webpack.config.js
test/configCases/asset-modules/type-text/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = {};
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/query-and-custom-condition/index.js
test/configCases/asset-modules/query-and-custom-condition/index.js
import png from "../_images/file.png?foo=bar"; import svg from "../_images/file.svg"; import jpg from "../_images/file.jpg?foo=bar#hash"; it("should output various asset types", () => { expect(png).toContain("data:image/png;base64,"); expect(svg).toMatch(/^[\da-f]{20}\.svg$/); expect(jpg).toContain("data:image/jpeg...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/query-and-custom-condition/webpack.config.js
test/configCases/asset-modules/query-and-custom-condition/webpack.config.js
"use strict"; /** @typedef {import("../../../../").ParserOptionsByModuleTypeKnown} ParserOptionsByModuleTypeKnown */ /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", module: { rules: [ { test: /\.(png|svg|jpg)$/, type: "asset", /** @type {ParserOptionsByMo...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/file-loader/index.js
test/configCases/asset-modules/file-loader/index.js
import url from "../_images/file.png"; it("should use file-loader", () => { expect(url).toEqual("file-loader.png"); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/file-loader/webpack.config.js
test/configCases/asset-modules/file-loader/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", module: { rules: [ { test: /\.png$/, loader: "file-loader", options: { name: "file-loader.[ext]" } } ] } };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/overridePath/index.js
test/configCases/asset-modules/overridePath/index.js
import url from "../_images/file.png"; import index from "../_static/file.html"; it("should output asset with path", () => { expect(url).toEqual("images/file.png"); expect(index).toEqual("static/index.html"); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/overridePath/webpack.config.js
test/configCases/asset-modules/overridePath/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", output: { assetModuleFilename: "images/file[ext]" }, module: { rules: [ { test: /\.png$/, type: "asset" }, { test: /\.html$/, type: "asset/resource", generator: { filename...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/generator-asset-publicPath/index.js
test/configCases/asset-modules/generator-asset-publicPath/index.js
import url from "../_images/file.png"; it("should import asset with module.generator.asset.publicPath", () => { expect(url).toEqual("assets/file.png"); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/generator-asset-publicPath/webpack.config.js
test/configCases/asset-modules/generator-asset-publicPath/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", output: { assetModuleFilename: "file[ext]" }, module: { rules: [ { test: /\.png$/, type: "asset" } ], generator: { asset: { publicPath: "assets/" } } } };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/resource-from-data-uri/index.js
test/configCases/asset-modules/resource-from-data-uri/index.js
import asset from "data:image/svg+xml;utf8,<svg><title>icon-square-small</title></svg>" it("should compile with correct filename", () => { expect(asset).toMatch(/public\/media\/[0-9a-zA-Z]{20}\.[0-9a-zA-Z]{8}\.svg/); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/resource-from-data-uri/webpack.config.js
test/configCases/asset-modules/resource-from-data-uri/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { output: { assetModuleFilename: "media/[name].[contenthash:8][ext]", publicPath: "public/" }, module: { rules: [ { mimetype: "image/svg+xml", type: "asset/resource" } ] }, target: "web" };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/data-url-broken/index.js
test/configCases/asset-modules/data-url-broken/index.js
it("should not crash", () => { let errored; try { const url = new URL( "unknown:test", import.meta.url ); } catch (err) { errored = err; } expect(/Module build failed/.test(errored.message)).toBe(true); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/data-url-broken/infrastructure-log.js
test/configCases/asset-modules/data-url-broken/infrastructure-log.js
"use strict"; module.exports = (options) => { if (options.cache && options.cache.type === "filesystem") { return [/Pack got invalid because of write to/]; } return []; };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/data-url-broken/webpack.config.js
test/configCases/asset-modules/data-url-broken/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", module: { rules: [ { test: /\.(png|svg)$/, type: "asset/inline" }, { mimetype: "image/svg+xml", type: "asset/inline" }, { test: /\.jpg$/, type: "asset", parser: { ...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/data-url-broken/errors.js
test/configCases/asset-modules/data-url-broken/errors.js
"use strict"; module.exports = [ /You may need an additional plugin to handle "unknown:" URIs./ ];
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/errored/index.js
test/configCases/asset-modules/errored/index.js
it("should use a valid output path", () => { try { new URL("./style.css", import.meta.url); } catch (e) { // Nothing } });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/errored/loader.js
test/configCases/asset-modules/errored/loader.js
module.exports = function loader() { throw new Error("Error from loader"); };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/errored/test.config.js
test/configCases/asset-modules/errored/test.config.js
"use strict"; const fs = require("fs"); const path = require("path"); module.exports = { afterExecute(options) { const files = fs.readdirSync(path.resolve(options.output.path, "./css")); if (!/style\.[0-9a-f]{8}\.css/.test(files[0])) { throw new Error(`Invalid path for ${files.join(",")} files.`); } } };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/errored/infrastructure-log.js
test/configCases/asset-modules/errored/infrastructure-log.js
"use strict"; module.exports = (options) => { if (options.cache && options.cache.type === "filesystem") { return [/Pack got invalid because of write to/]; } return []; };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/errored/webpack.config.js
test/configCases/asset-modules/errored/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", output: { hashDigestLength: 8 }, module: { rules: [ { test: /\.css$/i, type: "asset/resource", generator: { filename: () => "css/style.[contenthash].css" }, use: [ { ...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/errored/errors.js
test/configCases/asset-modules/errored/errors.js
"use strict"; module.exports = [/Error from loader/];
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/unsafe-cache-13827/index.js
test/configCases/asset-modules/unsafe-cache-13827/index.js
import url from "package"; it("should create a data url", () => { expect(url.protocol).toBe("data:"); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/unsafe-cache-13827/webpack.config.js
test/configCases/asset-modules/unsafe-cache-13827/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", module: { rules: [ { dependency: "url", type: "asset" } ] } };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/unsafe-cache-13827/node_modules/package/index.js
test/configCases/asset-modules/unsafe-cache-13827/node_modules/package/index.js
export default new URL("file.svg", import.meta.url);
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/source/index.js
test/configCases/asset-modules/source/index.js
import svg from "../_images/file.svg"; it("should receive asset source", () => { expect(svg).toMatch(/^<svg.+<\/svg>\s*$/); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/source/webpack.config.js
test/configCases/asset-modules/source/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", module: { rules: [ { test: /\.svg$/, type: "asset/source" } ] } };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/base-uri/index.js
test/configCases/asset-modules/base-uri/index.js
it("should handle different querystrings for assets correctly", () => { __webpack_base_uri__ = "https://example.com"; const file = new URL("../_images/file.png", import.meta.url); expect(file.href).toMatch(/^https:\/\/example.com\/path\/[0-9a-f]+.png$/); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/base-uri/webpack.config.js
test/configCases/asset-modules/base-uri/webpack.config.js
"use strict"; module.exports = { mode: "development", target: "web", output: { publicPath: "/path/" } };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/ignore/index.js
test/configCases/asset-modules/ignore/index.js
const url = new URL("image.png", import.meta.url); it("should output asset with path", () => { expect(url + "").toBe("data:,"); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/ignore/webpack.config.js
test/configCases/asset-modules/ignore/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", resolve: { alias: { "image.png": false } } };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/custom-encoder/index.js
test/configCases/asset-modules/custom-encoder/index.js
import png from "../_images/file.png"; import svg from "../_images/file.svg"; import jpg from "../_images/file.jpg"; it("should generate various asset types by a custom encoder", () => { expect(png).toMatch(/^data:mimetype\/png;base64,[0-9a-zA-Z+/]+=*$/); expect(jpg).toEqual("data:image/jpg;base64,custom-content"); ...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/custom-encoder/webpack.config.js
test/configCases/asset-modules/custom-encoder/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", module: { rules: [ { test: /\.png$/, type: "asset/inline", generator: { dataUrl: { mimetype: "mimetype/png" } } }, { test: /\.jpg$/, type: "asset/inline", g...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/data-url-extract/index.js
test/configCases/asset-modules/data-url-extract/index.js
const urlSvg = new URL( "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MDAgNjAwIj48dGl0bGU+aWNvbi1zcXVhcmUtc21hbGw8L3RpdGxlPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0zMDAgLjFMNTY1IDE1MHYyOTkuOUwzMDAgNTk5LjggMzUgNDQ5LjlWMTUweiIvPjxwYXRoIGZpbGw9IiM4RUQ2RkIiIGQ9Ik01MTcuNyA0MzkuNUwz...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/data-url-extract/webpack.config.js
test/configCases/asset-modules/data-url-extract/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", module: { rules: [ { mimetype: "image/gif", type: "asset/resource", generator: { filename: "[name][ext][query]" } }, { mimetype: "text/html", type: "asset/resource", g...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/entry-with-runtimeChunk/test.js
test/configCases/asset-modules/entry-with-runtimeChunk/test.js
it("should work", () => { const stats = __STATS__.children[__STATS_I__]; const test = stats.assets.find( a => a.name === "test.js" ); expect(Boolean(test)).toBe(true); const assetEntry = stats.assets.find( a => a.info.sourceFilename === "../_images/file.png" ); expect(Boolean(assetEntry)).toBe(true); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/entry-with-runtimeChunk/test.config.js
test/configCases/asset-modules/entry-with-runtimeChunk/test.config.js
"use strict"; module.exports = { findBundle(i, options) { const ext = options.output.module ? "mjs" : "js"; switch (i % 4) { case 0: return ["test.js", `${i}/runtime~app.${ext}`]; case 1: return ["test.js", `${i}/app.${ext}`, `${i}/runtime~app.${ext}`]; case 2: return ["test.js", `${i}/app.$...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/entry-with-runtimeChunk/entry.js
test/configCases/asset-modules/entry-with-runtimeChunk/entry.js
it("should compile and run", () => { expect(true).toBe(true) });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/entry-with-runtimeChunk/webpack.config.js
test/configCases/asset-modules/entry-with-runtimeChunk/webpack.config.js
"use strict"; const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ const common = { module: { rules: [ { test: /\.png$/, type: "asset" } ] }, experiments: { css: true }, plugins: [ { apply(com...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/types/index.js
test/configCases/asset-modules/types/index.js
import png from "../_images/file.png"; import svg from "../_images/file.svg"; import jpg from "../_images/file.jpg"; it("should output various asset types", () => { expect(png).toMatch(/^[\da-f]{20}\.png$/); expect(svg).toMatch(/^[\da-f]{20}\.svg$/); expect(jpg).toMatch(/^[\da-f]{20}\.jpg$/); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/types/webpack.config.js
test/configCases/asset-modules/types/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", module: { rules: [ { test: /\.(png|svg)$/, type: "asset/resource" }, { test: /\.jpg$/, type: "asset/resource" } ] } };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/query-and-hash/index.js
test/configCases/asset-modules/query-and-hash/index.js
import png from "../_images/file.png?foo=bar"; import svg from "../_images/file.svg?"; import jpg from "../_images/file.jpg?foo=bar#hash"; import copy from "../_images/file_copy.png#hash"; import fs from "fs"; it("should output various asset types", () => { expect(png).toMatch(/^[\da-f]{20}\.png\?foo=bar$/); expect(...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/query-and-hash/webpack.config.js
test/configCases/asset-modules/query-and-hash/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", output: { environment: { templateLiteral: false } }, module: { rules: [ { test: /\.(png|svg|jpg)$/, type: "asset/resource" } ] } };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/generator-asset-publicPath-hash/index.js
test/configCases/asset-modules/generator-asset-publicPath-hash/index.js
import url from "../_images/file.png"; it("should import asset with module.generator.asset.publicPath", () => { expect(url).toMatch(/^[a-f0-9]{20}\/assets\/[a-f0-9]{10}\.file\.png$/); const assetInfo = __STATS__.assets.find( a => a.info.sourceFilename === "../_images/file.png" ).info; expect(assetInfo.immutable)...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/generator-asset-publicPath-hash/webpack.config.js
test/configCases/asset-modules/generator-asset-publicPath-hash/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", output: { assetModuleFilename: "[contenthash:10].file[ext]" }, module: { rules: [ { test: /\.png$/, type: "asset" } ], generator: { asset: { publicPath: "[contenthash]/assets/" ...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/only-hash-url/index.js
test/configCases/asset-modules/only-hash-url/index.js
import img from "#internal"; it("should allow to use an URL started with '#'", () => { const url = new URL("#test", import.meta.url); expect(url.hash).toBe("#test"); }); it("should allow to use an URL started with '#'", () => { expect(img).toEndWith("path/images/file.png"); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/only-hash-url/webpack.config.js
test/configCases/asset-modules/only-hash-url/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", output: { assetModuleFilename: "images/file[ext]" }, module: { rules: [ { test: /\.png$/, type: "asset/resource" } ] }, target: "web" };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/input-data-url/index.js
test/configCases/asset-modules/input-data-url/index.js
it("should allow empty urls", () => { const url = new URL("data:,", import.meta.url); expect(url.href).toBe("data:,"); expect(url.protocol).toBe("data:"); expect(url.pathname).toBe(","); }); it("should allow empty urls with mimetype", () => { const url = new URL("data:test,", import.meta.url); expect(url.href).t...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/input-data-url/webpack.config.js
test/configCases/asset-modules/input-data-url/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", module: { rules: [ { mimetype: "image/svg+xml+external", type: "asset/resource", generator: { filename: "[hash].svg" } } ] }, target: "web" };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/publicPath/index.js
test/configCases/asset-modules/publicPath/index.js
import url from "../_images/file.png"; it("should import asset with correct publicPath", () => { expect(url).toEqual("assets/file.png"); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/publicPath/webpack.config.js
test/configCases/asset-modules/publicPath/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", output: { publicPath: "assets/", assetModuleFilename: "file[ext]", environment: { templateLiteral: true } }, module: { rules: [ { test: /\.png$/, type: "asset" } ] } };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/data-url/index.js
test/configCases/asset-modules/data-url/index.js
import png from "../_images/file.png"; import svg from "../_images/file.svg"; import jpg from "../_images/file.jpg"; import dataSvg from "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MDAgNjAwIj48dGl0bGU+aWNvbi1zcXVhcmUtc21hbGw8L3RpdGxlPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0z...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/data-url/loader.js
test/configCases/asset-modules/data-url/loader.js
/** @type {import("../../../../").LoaderDefinition<{ f(): any }>} */ module.exports = function (source) { return `${source}, World!`; };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/data-url/webpack.config.js
test/configCases/asset-modules/data-url/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", module: { rules: [ { test: /\.(png|svg)$/, type: "asset/inline" }, { mimetype: "image/svg+xml", type: "asset/inline" }, { test: /\.jpg$/, type: "asset", parser: { ...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/keep-source-maps/index.js
test/configCases/asset-modules/keep-source-maps/index.js
it("should write asset file to output directory", function() { const fs = require("fs"); const path = require("path"); const source = fs.readFileSync(path.join(__dirname, "asset.css"), "utf-8"); expect(source).toMatch("/*# sourceMappingURL=asset.css.map*/"); }); it("should write sourcemap file relative to fileCont...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/keep-source-maps/loader.js
test/configCases/asset-modules/keep-source-maps/loader.js
const fs = require("fs"); const path = require("path"); /** @type {import("../../../../").LoaderDefinition<{ f(): any }>} */ module.exports = function(_) { // return the would-be output from SASS without needing the compiler as a dependency const transformed = fs.readFileSync(path.join(__dirname, "data/asset.css"), ...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/keep-source-maps/webpack.config.js
test/configCases/asset-modules/keep-source-maps/webpack.config.js
"use strict"; /** @typedef {import("../../../../").GeneratorOptionsByModuleTypeKnown} GeneratorOptionsByModuleTypeKnown */ /** @type {import("../../../../").Configuration} */ module.exports = { node: { __dirname: false, __filename: false }, devtool: "source-map", entry: { bundle0: ["./index.js"], asset: [...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/rule-generator-publicPath-override/index.js
test/configCases/asset-modules/rule-generator-publicPath-override/index.js
import url from "../_images/file.png"; it("should import asset with empty string rule.generator.publicPath", () => { expect(url).toEqual("file.png"); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/rule-generator-publicPath-override/webpack.config.js
test/configCases/asset-modules/rule-generator-publicPath-override/webpack.config.js
"use strict"; /** @type {import("../../../../types").Configuration} */ module.exports = { mode: "development", output: { assetModuleFilename: "file[ext]", publicPath: "assets/" }, module: { rules: [ { test: /\.png$/, type: "asset", generator: { publicPath: "" } } ] } };
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/rule-generator-outputPath/index.js
test/configCases/asset-modules/rule-generator-outputPath/index.js
import url from "../_images/file.png"; import fs from "fs"; import path from "path"; it("should emit asset with module.generator.asset.outputPath", () => { expect(url).toEqual("https://cdn/assets/file.png"); const emitPath = path.join(__STATS__.outputPath, "cdn-assets/file.png") expect(fs.existsSync(emitPath)).toB...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/rule-generator-outputPath/webpack.config.js
test/configCases/asset-modules/rule-generator-outputPath/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", output: { assetModuleFilename: "file[ext]" }, module: { rules: [ { test: /\.png$/, type: "asset/resource", generator: { publicPath: "https://cdn/assets/", outputPath: "cdn-assets/"...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/global-and-local-options/index.js
test/configCases/asset-modules/global-and-local-options/index.js
import file1 from "./file-global.txt"; import file2 from "./file-local.txt"; it("should output and DATA URL and filename", () => { expect(file1).toMatch(/^data:text\/plain;base64,/); expect(file2).toMatch(/^[\da-f]{20}\.txt$/); });
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/global-and-local-options/webpack.config.js
test/configCases/asset-modules/global-and-local-options/webpack.config.js
"use strict"; /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", devtool: false, module: { parser: { asset: { dataUrlCondition() { return true; } } }, rules: [ { test: /file-global\.txt$/, type: "asset" }, { test: /file-local\.tx...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/custom-condition/index.js
test/configCases/asset-modules/custom-condition/index.js
import png from "../_images/file.png"; import svg from "../_images/file.svg"; import jpg from "../_images/file.jpg"; it("should generate various asset types by a custom encoder", () => { expect(png).toMatch(/^data:image\/png;base64,[0-9a-zA-Z+/]+=*$/); expect(jpg).toMatch(/^[\da-f]{20}\.jpg$/); expect(svg).toMatch(...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/custom-condition/webpack.config.js
test/configCases/asset-modules/custom-condition/webpack.config.js
"use strict"; const path = require("path"); const NormalModule = require("../../../../").NormalModule; /** @typedef {import("../../../../").ParserOptionsByModuleTypeKnown} ParserOptionsByModuleTypeKnown */ /** @type {import("../../../../").Configuration} */ module.exports = { mode: "development", module: { rules...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/bytes/test.filter.js
test/configCases/asset-modules/bytes/test.filter.js
"use strict"; const supportsTextDecoder = require("../../../helpers/supportsTextDecoder"); module.exports = () => supportsTextDecoder();
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false
webpack/webpack
https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/test/configCases/asset-modules/bytes/index.js
test/configCases/asset-modules/bytes/index.js
import * as style from "./style.css"; import file from "./file.text" with { type: "bytes" }; it("should work", async () => { const decoder = new TextDecoder('utf-8'); const text = decoder.decode(file); expect(text).toBe("a Ā 𐀀 文 🦄 Text"); const dyn = (await import("./file.text?other", { with: { type: "bytes" }...
javascript
MIT
d2a124db548cad6e84dffd93b502a4e74bfe2b6a
2026-01-04T14:56:49.698101Z
false