Skip to content

Commit dd56b6b

Browse files
committed
feat: generate more collision resistant localIdentHash'es:
It should work with custom hash functions like xxhash64
1 parent c3dfeaf commit dd56b6b

File tree

3 files changed

+210
-5
lines changed

3 files changed

+210
-5
lines changed

src/utils.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,7 @@ function defaultGetLocalIdent(
360360
}
361361

362362
let localIdentHash = "";
363-
for (
364-
const tierSalt = Uint32Array.of(0);
365-
localIdentHash.length < hashDigestLength;
366-
tierSalt[0]++
367-
) {
363+
for (let tier = 0; localIdentHash.length < hashDigestLength; tier++) {
368364
// eslint-disable-next-line no-underscore-dangle
369365
const hash = loaderContext._compiler.webpack.util.createHash(hashFunction);
370366
const { hashSalt } = options;
@@ -373,6 +369,8 @@ function defaultGetLocalIdent(
373369
hash.update(hashSalt);
374370
}
375371

372+
const tierSalt = Buffer.allocUnsafe(4);
373+
tierSalt.writeUInt32LE(tier);
376374
hash.update(tierSalt);
377375

378376
hash.update(options.content);

test/__snapshots__/modules-option.test.js.snap

+188
Original file line numberDiff line numberDiff line change
@@ -5446,6 +5446,194 @@ Array [
54465446

54475447
exports[`"modules" option should work with "false" alises: warnings 1`] = `Array []`;
54485448

5449+
exports[`"modules" option should work with "localIdentHashFunction" xxhash64: errors 1`] = `Array []`;
5450+
5451+
exports[`"modules" option should work with "localIdentHashFunction" xxhash64: module 1`] = `
5452+
"// Imports
5453+
import ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \\"../../../../src/runtime/noSourceMaps.js\\";
5454+
import ___CSS_LOADER_API_IMPORT___ from \\"../../../../src/runtime/api.js\\";
5455+
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
5456+
// Module
5457+
___CSS_LOADER_EXPORT___.push([module.id, \\".test--eaea596870e1bfab1c35 {\\\\n background: red;\\\\n}\\\\n\\\\n._test--be23e2aa677d8474962e {\\\\n background: blue;\\\\n}\\\\n\\\\n.className--eba40faa5cba4e02fb34 {\\\\n background: red;\\\\n}\\\\n\\\\n#someId--d4d26a899717294ba284 {\\\\n background: green;\\\\n}\\\\n\\\\n.className--eba40faa5cba4e02fb34 .subClass--a5d79cf334356eb226c7 {\\\\n color: green;\\\\n}\\\\n\\\\n#someId--d4d26a899717294ba284 .subClass--a5d79cf334356eb226c7 {\\\\n color: blue;\\\\n}\\\\n\\\\n.-a0-34a___f--ad1081468f62c0a71134 {\\\\n color: red;\\\\n}\\\\n\\\\n.m_x_\\\\\\\\@--d9d6a4c97ab5d8e0b7ef {\\\\n margin-left: auto !important;\\\\n margin-right: auto !important;\\\\n}\\\\n\\\\n.B\\\\\\\\&W\\\\\\\\?--e69d1ebb6c7ecce1b64f {\\\\n margin-left: auto !important;\\\\n margin-right: auto !important;\\\\n}\\\\n\\\\n/* matches elements with class=\\\\\\":\`(\\\\\\" */\\\\n.\\\\\\\\3A \\\\\\\\\`\\\\\\\\(--fc3eefdc1114297d5c40 {\\\\n color: aqua;\\\\n}\\\\n\\\\n/* matches elements with class=\\\\\\"1a2b3c\\\\\\" */\\\\n.\\\\\\\\31 a2b3c--a3e5d0f16b2ec4feed21 {\\\\n color: aliceblue;\\\\n}\\\\n\\\\n/* matches the element with id=\\\\\\"#fake-id\\\\\\" */\\\\n#\\\\\\\\#fake-id--e107fdb198ac826daeac {\\\\n color: antiquewhite;\\\\n}\\\\n\\\\n/* matches the element with id=\\\\\\"-a-b-c-\\\\\\" */\\\\n#-a-b-c---d272b409c9b136e17983 {\\\\n color: azure;\\\\n}\\\\n\\\\n/* matches the element with id=\\\\\\"©\\\\\\" */\\\\n#©--c735aef17e002be4e48a {\\\\n color: black;\\\\n}\\\\n\\\\n.♥--ae10da605c051a40ae10 { background: lime; }\\\\n.©--c735aef17e002be4e48a { background: lime; }\\\\n.“‘’”--ae10da605c051a40ae10 { background: lime; }\\\\n.☺☃--ae10da605c051a40ae10 { background: lime; }\\\\n.⌘⌥--ae10da605c051a40ae10 { background: lime; }\\\\n.𝄞♪♩♫♬--ba2a1d2a4b331a04e547 { background: lime; }\\\\n.💩--ae10da605c051a40ae10 { background: lime; }\\\\n.\\\\\\\\?--f956b8b9c523ebdb67e5 { background: lime; }\\\\n.\\\\\\\\@--dcc8fa5146b1dbb20b36 { background: lime; }\\\\n.\\\\\\\\.--f37c2cb9b33fd73cfd48 { background: lime; }\\\\n.\\\\\\\\3A \\\\\\\\)--bd7812f18a8252e6870a { background: lime; }\\\\n.\\\\\\\\3A \\\\\\\\\`\\\\\\\\(--fc3eefdc1114297d5c40 { background: lime; }\\\\n.\\\\\\\\31 23--cd0937b62810349cd373 { background: lime; }\\\\n.\\\\\\\\31 a2b3c--a3e5d0f16b2ec4feed21 { background: lime; }\\\\n.\\\\\\\\<p\\\\\\\\>--bc6b0face7c24fdda701 { background: lime; }\\\\n.\\\\\\\\<\\\\\\\\>\\\\\\\\<\\\\\\\\<\\\\\\\\<\\\\\\\\>\\\\\\\\>\\\\\\\\<\\\\\\\\>--a237de2ced117ff0a191 { background: lime; }\\\\n.\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\[\\\\\\\\>\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\>\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\>\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\>\\\\\\\\+\\\\\\\\<\\\\\\\\<\\\\\\\\<\\\\\\\\<\\\\\\\\-\\\\\\\\]\\\\\\\\>\\\\\\\\+\\\\\\\\+\\\\\\\\.\\\\\\\\>\\\\\\\\+\\\\\\\\.\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\.\\\\\\\\.\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\.\\\\\\\\>\\\\\\\\+\\\\\\\\+\\\\\\\\.\\\\\\\\<\\\\\\\\<\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\.\\\\\\\\>\\\\\\\\.\\\\\\\\+\\\\\\\\+\\\\\\\\+\\\\\\\\.\\\\\\\\-\\\\\\\\-\\\\\\\\-\\\\\\\\-\\\\\\\\-\\\\\\\\-\\\\\\\\.\\\\\\\\-\\\\\\\\-\\\\\\\\-\\\\\\\\-\\\\\\\\-\\\\\\\\-\\\\\\\\-\\\\\\\\-\\\\\\\\.\\\\\\\\>\\\\\\\\+\\\\\\\\.\\\\\\\\>\\\\\\\\.--eb8b2e976f60512d2a9d { background: lime; }\\\\n.\\\\\\\\#--cea7340e43560d89a150 { background: lime; }\\\\n.\\\\\\\\#\\\\\\\\#--f8d94fd6adc56e0632f7 { background: lime; }\\\\n.\\\\\\\\#\\\\\\\\.\\\\\\\\#\\\\\\\\.\\\\\\\\#--e640a3e0b78af4dfc5f3 { background: lime; }\\\\n.\\\\\\\\_--a54672d2425992dd98a3 { background: lime; }\\\\n.\\\\\\\\{\\\\\\\\}--a6edf97d95943b5e1caa { background: lime; }\\\\n.\\\\\\\\#fake\\\\\\\\-id--e107fdb198ac826daeac { background: lime; }\\\\n.foo\\\\\\\\.bar--e25f746c297da2218a7b { background: lime; }\\\\n.\\\\\\\\3A hover--be204fb0f66fc0246d1f { background: lime; }\\\\n.\\\\\\\\3A hover\\\\\\\\3A focus\\\\\\\\3A active--cdd1dd345eead04fd4df { background: lime; }\\\\n.\\\\\\\\[attr\\\\\\\\=value\\\\\\\\]--c62830d38d8d716893eb { background: lime; }\\\\n.f\\\\\\\\/o\\\\\\\\/o--fbca7ba56e09ecbbc62c { background: lime; }\\\\n.f\\\\\\\\\\\\\\\\o\\\\\\\\\\\\\\\\o--d45f79a6d98695cdf7b8 { background: lime; }\\\\n.f\\\\\\\\*o\\\\\\\\*o--a40517bd0d8d54cdf2e9 { background: lime; }\\\\n.f\\\\\\\\!o\\\\\\\\!o--ca15427719be1c4d9202 { background: lime; }\\\\n.f\\\\\\\\'o\\\\\\\\'o--d66cc50b7a1d7fea63dc { background: lime; }\\\\n.f\\\\\\\\~o\\\\\\\\~o--b87d149677e776a8f870 { background: lime; }\\\\n.f\\\\\\\\+o\\\\\\\\+o--cac6afc7828cdeec9b8e { background: lime; }\\\\n\\\\n.foo\\\\\\\\/bar--f18e2cdd363bb8ad04dc {\\\\n background: hotpink;\\\\n}\\\\n\\\\n.foo\\\\\\\\\\\\\\\\bar--b7fb1775501d478f7ddd {\\\\n background: hotpink;\\\\n}\\\\n\\\\n.foo\\\\\\\\/bar\\\\\\\\/baz--e770299577106c0871c6 {\\\\n background: hotpink;\\\\n}\\\\n\\\\n.foo\\\\\\\\\\\\\\\\bar\\\\\\\\\\\\\\\\baz--f06100a42cf29105670c {\\\\n background: hotpink;\\\\n}\\\\n\\", \\"\\"]);
5458+
// Exports
5459+
___CSS_LOADER_EXPORT___.locals = {
5460+
\\"123\\": \\"123--cd0937b62810349cd373\\",
5461+
\\"test\\": \\"test--eaea596870e1bfab1c35\\",
5462+
\\"_test\\": \\"_test--be23e2aa677d8474962e\\",
5463+
\\"className\\": \\"className--eba40faa5cba4e02fb34\\",
5464+
\\"someId\\": \\"someId--d4d26a899717294ba284\\",
5465+
\\"subClass\\": \\"subClass--a5d79cf334356eb226c7\\",
5466+
\\"-a0-34a___f\\": \\"-a0-34a___f--ad1081468f62c0a71134\\",
5467+
\\"m_x_@\\": \\"m_x_@--d9d6a4c97ab5d8e0b7ef\\",
5468+
\\"B&W?\\": \\"B&W?--e69d1ebb6c7ecce1b64f\\",
5469+
\\":\`(\\": \\":\`(--fc3eefdc1114297d5c40\\",
5470+
\\"1a2b3c\\": \\"1a2b3c--a3e5d0f16b2ec4feed21\\",
5471+
\\"#fake-id\\": \\"#fake-id--e107fdb198ac826daeac\\",
5472+
\\"-a-b-c-\\": \\"-a-b-c---d272b409c9b136e17983\\",
5473+
\\"©\\": \\"©--c735aef17e002be4e48a\\",
5474+
\\"♥\\": \\"♥--ae10da605c051a40ae10\\",
5475+
\\"“‘’”\\": \\"“‘’”--ae10da605c051a40ae10\\",
5476+
\\"☺☃\\": \\"☺☃--ae10da605c051a40ae10\\",
5477+
\\"⌘⌥\\": \\"⌘⌥--ae10da605c051a40ae10\\",
5478+
\\"𝄞♪♩♫♬\\": \\"𝄞♪♩♫♬--ba2a1d2a4b331a04e547\\",
5479+
\\"💩\\": \\"💩--ae10da605c051a40ae10\\",
5480+
\\"?\\": \\"?--f956b8b9c523ebdb67e5\\",
5481+
\\"@\\": \\"@--dcc8fa5146b1dbb20b36\\",
5482+
\\".\\": \\".--f37c2cb9b33fd73cfd48\\",
5483+
\\":)\\": \\":)--bd7812f18a8252e6870a\\",
5484+
\\"<p>\\": \\"<p>--bc6b0face7c24fdda701\\",
5485+
\\"<><<<>><>\\": \\"<><<<>><>--a237de2ced117ff0a191\\",
5486+
\\"++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.\\": \\"++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.--eb8b2e976f60512d2a9d\\",
5487+
\\"#\\": \\"#--cea7340e43560d89a150\\",
5488+
\\"##\\": \\"##--f8d94fd6adc56e0632f7\\",
5489+
\\"#.#.#\\": \\"#.#.#--e640a3e0b78af4dfc5f3\\",
5490+
\\"_\\": \\"_--a54672d2425992dd98a3\\",
5491+
\\"{}\\": \\"{}--a6edf97d95943b5e1caa\\",
5492+
\\"foo.bar\\": \\"foo.bar--e25f746c297da2218a7b\\",
5493+
\\":hover\\": \\":hover--be204fb0f66fc0246d1f\\",
5494+
\\":hover:focus:active\\": \\":hover:focus:active--cdd1dd345eead04fd4df\\",
5495+
\\"[attr=value]\\": \\"[attr=value]--c62830d38d8d716893eb\\",
5496+
\\"f/o/o\\": \\"f/o/o--fbca7ba56e09ecbbc62c\\",
5497+
\\"f\\\\\\\\o\\\\\\\\o\\": \\"f\\\\\\\\o\\\\\\\\o--d45f79a6d98695cdf7b8\\",
5498+
\\"f*o*o\\": \\"f*o*o--a40517bd0d8d54cdf2e9\\",
5499+
\\"f!o!o\\": \\"f!o!o--ca15427719be1c4d9202\\",
5500+
\\"f'o'o\\": \\"f'o'o--d66cc50b7a1d7fea63dc\\",
5501+
\\"f~o~o\\": \\"f~o~o--b87d149677e776a8f870\\",
5502+
\\"f+o+o\\": \\"f+o+o--cac6afc7828cdeec9b8e\\",
5503+
\\"foo/bar\\": \\"foo/bar--f18e2cdd363bb8ad04dc\\",
5504+
\\"foo\\\\\\\\bar\\": \\"foo\\\\\\\\bar--b7fb1775501d478f7ddd\\",
5505+
\\"foo/bar/baz\\": \\"foo/bar/baz--e770299577106c0871c6\\",
5506+
\\"foo\\\\\\\\bar\\\\\\\\baz\\": \\"foo\\\\\\\\bar\\\\\\\\baz--f06100a42cf29105670c\\"
5507+
};
5508+
export default ___CSS_LOADER_EXPORT___;
5509+
"
5510+
`;
5511+
5512+
exports[`"modules" option should work with "localIdentHashFunction" xxhash64: result 1`] = `
5513+
Array [
5514+
Array [
5515+
"./modules/localIdentName/localIdentName.css",
5516+
".test--eaea596870e1bfab1c35 {
5517+
background: red;
5518+
}
5519+
5520+
._test--be23e2aa677d8474962e {
5521+
background: blue;
5522+
}
5523+
5524+
.className--eba40faa5cba4e02fb34 {
5525+
background: red;
5526+
}
5527+
5528+
#someId--d4d26a899717294ba284 {
5529+
background: green;
5530+
}
5531+
5532+
.className--eba40faa5cba4e02fb34 .subClass--a5d79cf334356eb226c7 {
5533+
color: green;
5534+
}
5535+
5536+
#someId--d4d26a899717294ba284 .subClass--a5d79cf334356eb226c7 {
5537+
color: blue;
5538+
}
5539+
5540+
.-a0-34a___f--ad1081468f62c0a71134 {
5541+
color: red;
5542+
}
5543+
5544+
.m_x_\\\\@--d9d6a4c97ab5d8e0b7ef {
5545+
margin-left: auto !important;
5546+
margin-right: auto !important;
5547+
}
5548+
5549+
.B\\\\&W\\\\?--e69d1ebb6c7ecce1b64f {
5550+
margin-left: auto !important;
5551+
margin-right: auto !important;
5552+
}
5553+
5554+
/* matches elements with class=\\":\`(\\" */
5555+
.\\\\3A \\\\\`\\\\(--fc3eefdc1114297d5c40 {
5556+
color: aqua;
5557+
}
5558+
5559+
/* matches elements with class=\\"1a2b3c\\" */
5560+
.\\\\31 a2b3c--a3e5d0f16b2ec4feed21 {
5561+
color: aliceblue;
5562+
}
5563+
5564+
/* matches the element with id=\\"#fake-id\\" */
5565+
#\\\\#fake-id--e107fdb198ac826daeac {
5566+
color: antiquewhite;
5567+
}
5568+
5569+
/* matches the element with id=\\"-a-b-c-\\" */
5570+
#-a-b-c---d272b409c9b136e17983 {
5571+
color: azure;
5572+
}
5573+
5574+
/* matches the element with id=\\"©\\" */
5575+
#©--c735aef17e002be4e48a {
5576+
color: black;
5577+
}
5578+
5579+
.♥--ae10da605c051a40ae10 { background: lime; }
5580+
.©--c735aef17e002be4e48a { background: lime; }
5581+
.“‘’”--ae10da605c051a40ae10 { background: lime; }
5582+
.☺☃--ae10da605c051a40ae10 { background: lime; }
5583+
.⌘⌥--ae10da605c051a40ae10 { background: lime; }
5584+
.𝄞♪♩♫♬--ba2a1d2a4b331a04e547 { background: lime; }
5585+
.💩--ae10da605c051a40ae10 { background: lime; }
5586+
.\\\\?--f956b8b9c523ebdb67e5 { background: lime; }
5587+
.\\\\@--dcc8fa5146b1dbb20b36 { background: lime; }
5588+
.\\\\.--f37c2cb9b33fd73cfd48 { background: lime; }
5589+
.\\\\3A \\\\)--bd7812f18a8252e6870a { background: lime; }
5590+
.\\\\3A \\\\\`\\\\(--fc3eefdc1114297d5c40 { background: lime; }
5591+
.\\\\31 23--cd0937b62810349cd373 { background: lime; }
5592+
.\\\\31 a2b3c--a3e5d0f16b2ec4feed21 { background: lime; }
5593+
.\\\\<p\\\\>--bc6b0face7c24fdda701 { background: lime; }
5594+
.\\\\<\\\\>\\\\<\\\\<\\\\<\\\\>\\\\>\\\\<\\\\>--a237de2ced117ff0a191 { background: lime; }
5595+
.\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\[\\\\>\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\>\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\>\\\\+\\\\+\\\\+\\\\>\\\\+\\\\<\\\\<\\\\<\\\\<\\\\-\\\\]\\\\>\\\\+\\\\+\\\\.\\\\>\\\\+\\\\.\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\.\\\\.\\\\+\\\\+\\\\+\\\\.\\\\>\\\\+\\\\+\\\\.\\\\<\\\\<\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\.\\\\>\\\\.\\\\+\\\\+\\\\+\\\\.\\\\-\\\\-\\\\-\\\\-\\\\-\\\\-\\\\.\\\\-\\\\-\\\\-\\\\-\\\\-\\\\-\\\\-\\\\-\\\\.\\\\>\\\\+\\\\.\\\\>\\\\.--eb8b2e976f60512d2a9d { background: lime; }
5596+
.\\\\#--cea7340e43560d89a150 { background: lime; }
5597+
.\\\\#\\\\#--f8d94fd6adc56e0632f7 { background: lime; }
5598+
.\\\\#\\\\.\\\\#\\\\.\\\\#--e640a3e0b78af4dfc5f3 { background: lime; }
5599+
.\\\\_--a54672d2425992dd98a3 { background: lime; }
5600+
.\\\\{\\\\}--a6edf97d95943b5e1caa { background: lime; }
5601+
.\\\\#fake\\\\-id--e107fdb198ac826daeac { background: lime; }
5602+
.foo\\\\.bar--e25f746c297da2218a7b { background: lime; }
5603+
.\\\\3A hover--be204fb0f66fc0246d1f { background: lime; }
5604+
.\\\\3A hover\\\\3A focus\\\\3A active--cdd1dd345eead04fd4df { background: lime; }
5605+
.\\\\[attr\\\\=value\\\\]--c62830d38d8d716893eb { background: lime; }
5606+
.f\\\\/o\\\\/o--fbca7ba56e09ecbbc62c { background: lime; }
5607+
.f\\\\\\\\o\\\\\\\\o--d45f79a6d98695cdf7b8 { background: lime; }
5608+
.f\\\\*o\\\\*o--a40517bd0d8d54cdf2e9 { background: lime; }
5609+
.f\\\\!o\\\\!o--ca15427719be1c4d9202 { background: lime; }
5610+
.f\\\\'o\\\\'o--d66cc50b7a1d7fea63dc { background: lime; }
5611+
.f\\\\~o\\\\~o--b87d149677e776a8f870 { background: lime; }
5612+
.f\\\\+o\\\\+o--cac6afc7828cdeec9b8e { background: lime; }
5613+
5614+
.foo\\\\/bar--f18e2cdd363bb8ad04dc {
5615+
background: hotpink;
5616+
}
5617+
5618+
.foo\\\\\\\\bar--b7fb1775501d478f7ddd {
5619+
background: hotpink;
5620+
}
5621+
5622+
.foo\\\\/bar\\\\/baz--e770299577106c0871c6 {
5623+
background: hotpink;
5624+
}
5625+
5626+
.foo\\\\\\\\bar\\\\\\\\baz--f06100a42cf29105670c {
5627+
background: hotpink;
5628+
}
5629+
",
5630+
"",
5631+
],
5632+
]
5633+
`;
5634+
5635+
exports[`"modules" option should work with "localIdentHashFunction" xxhash64: warnings 1`] = `Array []`;
5636+
54495637
exports[`"modules" option should work with "url" and "namedExport": errors 1`] = `Array []`;
54505638

54515639
exports[`"modules" option should work with "url" and "namedExport": module 1`] = `

test/modules-option.test.js

+19
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,25 @@ describe('"modules" option', () => {
222222
expect(getErrors(stats)).toMatchSnapshot("errors");
223223
});
224224

225+
it('should work with "localIdentHashFunction" xxhash64', async () => {
226+
const compiler = getCompiler("./modules/localIdentName/localIdentName.js", {
227+
modules: {
228+
localIdentName: "[local]--[hash]",
229+
localIdentHashFunction: "xxhash64",
230+
},
231+
});
232+
const stats = await compile(compiler);
233+
234+
expect(
235+
getModuleSource("./modules/localIdentName/localIdentName.css", stats)
236+
).toMatchSnapshot("module");
237+
expect(getExecutedCode("main.bundle.js", compiler, stats)).toMatchSnapshot(
238+
"result"
239+
);
240+
expect(getWarnings(stats)).toMatchSnapshot("warnings");
241+
expect(getErrors(stats)).toMatchSnapshot("errors");
242+
});
243+
225244
it('should work and respect the "localIdentHashFunction" option', async () => {
226245
const compiler = getCompiler("./modules/localIdentName/localIdentName.js", {
227246
modules: {

0 commit comments

Comments
 (0)