Skip to content

Commit 247090d

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

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
@@ -5526,6 +5526,194 @@ Array [
55265526

55275527
exports[`"modules" option should work with "false" aliases: warnings 1`] = `Array []`;
55285528

5529+
exports[`"modules" option should work with "localIdentHashFunction" xxhash64: errors 1`] = `Array []`;
5530+
5531+
exports[`"modules" option should work with "localIdentHashFunction" xxhash64: module 1`] = `
5532+
"// Imports
5533+
import ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \\"../../../../src/runtime/noSourceMaps.js\\";
5534+
import ___CSS_LOADER_API_IMPORT___ from \\"../../../../src/runtime/api.js\\";
5535+
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
5536+
// Module
5537+
___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\\", \\"\\"]);
5538+
// Exports
5539+
___CSS_LOADER_EXPORT___.locals = {
5540+
\\"123\\": \\"123--cd0937b62810349cd373\\",
5541+
\\"test\\": \\"test--eaea596870e1bfab1c35\\",
5542+
\\"_test\\": \\"_test--be23e2aa677d8474962e\\",
5543+
\\"className\\": \\"className--eba40faa5cba4e02fb34\\",
5544+
\\"someId\\": \\"someId--d4d26a899717294ba284\\",
5545+
\\"subClass\\": \\"subClass--a5d79cf334356eb226c7\\",
5546+
\\"-a0-34a___f\\": \\"-a0-34a___f--ad1081468f62c0a71134\\",
5547+
\\"m_x_@\\": \\"m_x_@--d9d6a4c97ab5d8e0b7ef\\",
5548+
\\"B&W?\\": \\"B&W?--e69d1ebb6c7ecce1b64f\\",
5549+
\\":\`(\\": \\":\`(--fc3eefdc1114297d5c40\\",
5550+
\\"1a2b3c\\": \\"1a2b3c--a3e5d0f16b2ec4feed21\\",
5551+
\\"#fake-id\\": \\"#fake-id--e107fdb198ac826daeac\\",
5552+
\\"-a-b-c-\\": \\"-a-b-c---d272b409c9b136e17983\\",
5553+
\\"©\\": \\"©--c735aef17e002be4e48a\\",
5554+
\\"♥\\": \\"♥--ae10da605c051a40ae10\\",
5555+
\\"“‘’”\\": \\"“‘’”--ae10da605c051a40ae10\\",
5556+
\\"☺☃\\": \\"☺☃--ae10da605c051a40ae10\\",
5557+
\\"⌘⌥\\": \\"⌘⌥--ae10da605c051a40ae10\\",
5558+
\\"𝄞♪♩♫♬\\": \\"𝄞♪♩♫♬--ba2a1d2a4b331a04e547\\",
5559+
\\"💩\\": \\"💩--ae10da605c051a40ae10\\",
5560+
\\"?\\": \\"?--f956b8b9c523ebdb67e5\\",
5561+
\\"@\\": \\"@--dcc8fa5146b1dbb20b36\\",
5562+
\\".\\": \\".--f37c2cb9b33fd73cfd48\\",
5563+
\\":)\\": \\":)--bd7812f18a8252e6870a\\",
5564+
\\"<p>\\": \\"<p>--bc6b0face7c24fdda701\\",
5565+
\\"<><<<>><>\\": \\"<><<<>><>--a237de2ced117ff0a191\\",
5566+
\\"++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.\\": \\"++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.--eb8b2e976f60512d2a9d\\",
5567+
\\"#\\": \\"#--cea7340e43560d89a150\\",
5568+
\\"##\\": \\"##--f8d94fd6adc56e0632f7\\",
5569+
\\"#.#.#\\": \\"#.#.#--e640a3e0b78af4dfc5f3\\",
5570+
\\"_\\": \\"_--a54672d2425992dd98a3\\",
5571+
\\"{}\\": \\"{}--a6edf97d95943b5e1caa\\",
5572+
\\"foo.bar\\": \\"foo.bar--e25f746c297da2218a7b\\",
5573+
\\":hover\\": \\":hover--be204fb0f66fc0246d1f\\",
5574+
\\":hover:focus:active\\": \\":hover:focus:active--cdd1dd345eead04fd4df\\",
5575+
\\"[attr=value]\\": \\"[attr=value]--c62830d38d8d716893eb\\",
5576+
\\"f/o/o\\": \\"f/o/o--fbca7ba56e09ecbbc62c\\",
5577+
\\"f\\\\\\\\o\\\\\\\\o\\": \\"f\\\\\\\\o\\\\\\\\o--d45f79a6d98695cdf7b8\\",
5578+
\\"f*o*o\\": \\"f*o*o--a40517bd0d8d54cdf2e9\\",
5579+
\\"f!o!o\\": \\"f!o!o--ca15427719be1c4d9202\\",
5580+
\\"f'o'o\\": \\"f'o'o--d66cc50b7a1d7fea63dc\\",
5581+
\\"f~o~o\\": \\"f~o~o--b87d149677e776a8f870\\",
5582+
\\"f+o+o\\": \\"f+o+o--cac6afc7828cdeec9b8e\\",
5583+
\\"foo/bar\\": \\"foo/bar--f18e2cdd363bb8ad04dc\\",
5584+
\\"foo\\\\\\\\bar\\": \\"foo\\\\\\\\bar--b7fb1775501d478f7ddd\\",
5585+
\\"foo/bar/baz\\": \\"foo/bar/baz--e770299577106c0871c6\\",
5586+
\\"foo\\\\\\\\bar\\\\\\\\baz\\": \\"foo\\\\\\\\bar\\\\\\\\baz--f06100a42cf29105670c\\"
5587+
};
5588+
export default ___CSS_LOADER_EXPORT___;
5589+
"
5590+
`;
5591+
5592+
exports[`"modules" option should work with "localIdentHashFunction" xxhash64: result 1`] = `
5593+
Array [
5594+
Array [
5595+
"./modules/localIdentName/localIdentName.css",
5596+
".test--eaea596870e1bfab1c35 {
5597+
background: red;
5598+
}
5599+
5600+
._test--be23e2aa677d8474962e {
5601+
background: blue;
5602+
}
5603+
5604+
.className--eba40faa5cba4e02fb34 {
5605+
background: red;
5606+
}
5607+
5608+
#someId--d4d26a899717294ba284 {
5609+
background: green;
5610+
}
5611+
5612+
.className--eba40faa5cba4e02fb34 .subClass--a5d79cf334356eb226c7 {
5613+
color: green;
5614+
}
5615+
5616+
#someId--d4d26a899717294ba284 .subClass--a5d79cf334356eb226c7 {
5617+
color: blue;
5618+
}
5619+
5620+
.-a0-34a___f--ad1081468f62c0a71134 {
5621+
color: red;
5622+
}
5623+
5624+
.m_x_\\\\@--d9d6a4c97ab5d8e0b7ef {
5625+
margin-left: auto !important;
5626+
margin-right: auto !important;
5627+
}
5628+
5629+
.B\\\\&W\\\\?--e69d1ebb6c7ecce1b64f {
5630+
margin-left: auto !important;
5631+
margin-right: auto !important;
5632+
}
5633+
5634+
/* matches elements with class=\\":\`(\\" */
5635+
.\\\\3A \\\\\`\\\\(--fc3eefdc1114297d5c40 {
5636+
color: aqua;
5637+
}
5638+
5639+
/* matches elements with class=\\"1a2b3c\\" */
5640+
.\\\\31 a2b3c--a3e5d0f16b2ec4feed21 {
5641+
color: aliceblue;
5642+
}
5643+
5644+
/* matches the element with id=\\"#fake-id\\" */
5645+
#\\\\#fake-id--e107fdb198ac826daeac {
5646+
color: antiquewhite;
5647+
}
5648+
5649+
/* matches the element with id=\\"-a-b-c-\\" */
5650+
#-a-b-c---d272b409c9b136e17983 {
5651+
color: azure;
5652+
}
5653+
5654+
/* matches the element with id=\\"©\\" */
5655+
#©--c735aef17e002be4e48a {
5656+
color: black;
5657+
}
5658+
5659+
.♥--ae10da605c051a40ae10 { background: lime; }
5660+
.©--c735aef17e002be4e48a { background: lime; }
5661+
.“‘’”--ae10da605c051a40ae10 { background: lime; }
5662+
.☺☃--ae10da605c051a40ae10 { background: lime; }
5663+
.⌘⌥--ae10da605c051a40ae10 { background: lime; }
5664+
.𝄞♪♩♫♬--ba2a1d2a4b331a04e547 { background: lime; }
5665+
.💩--ae10da605c051a40ae10 { background: lime; }
5666+
.\\\\?--f956b8b9c523ebdb67e5 { background: lime; }
5667+
.\\\\@--dcc8fa5146b1dbb20b36 { background: lime; }
5668+
.\\\\.--f37c2cb9b33fd73cfd48 { background: lime; }
5669+
.\\\\3A \\\\)--bd7812f18a8252e6870a { background: lime; }
5670+
.\\\\3A \\\\\`\\\\(--fc3eefdc1114297d5c40 { background: lime; }
5671+
.\\\\31 23--cd0937b62810349cd373 { background: lime; }
5672+
.\\\\31 a2b3c--a3e5d0f16b2ec4feed21 { background: lime; }
5673+
.\\\\<p\\\\>--bc6b0face7c24fdda701 { background: lime; }
5674+
.\\\\<\\\\>\\\\<\\\\<\\\\<\\\\>\\\\>\\\\<\\\\>--a237de2ced117ff0a191 { background: lime; }
5675+
.\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\[\\\\>\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\>\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\>\\\\+\\\\+\\\\+\\\\>\\\\+\\\\<\\\\<\\\\<\\\\<\\\\-\\\\]\\\\>\\\\+\\\\+\\\\.\\\\>\\\\+\\\\.\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\.\\\\.\\\\+\\\\+\\\\+\\\\.\\\\>\\\\+\\\\+\\\\.\\\\<\\\\<\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\+\\\\.\\\\>\\\\.\\\\+\\\\+\\\\+\\\\.\\\\-\\\\-\\\\-\\\\-\\\\-\\\\-\\\\.\\\\-\\\\-\\\\-\\\\-\\\\-\\\\-\\\\-\\\\-\\\\.\\\\>\\\\+\\\\.\\\\>\\\\.--eb8b2e976f60512d2a9d { background: lime; }
5676+
.\\\\#--cea7340e43560d89a150 { background: lime; }
5677+
.\\\\#\\\\#--f8d94fd6adc56e0632f7 { background: lime; }
5678+
.\\\\#\\\\.\\\\#\\\\.\\\\#--e640a3e0b78af4dfc5f3 { background: lime; }
5679+
.\\\\_--a54672d2425992dd98a3 { background: lime; }
5680+
.\\\\{\\\\}--a6edf97d95943b5e1caa { background: lime; }
5681+
.\\\\#fake\\\\-id--e107fdb198ac826daeac { background: lime; }
5682+
.foo\\\\.bar--e25f746c297da2218a7b { background: lime; }
5683+
.\\\\3A hover--be204fb0f66fc0246d1f { background: lime; }
5684+
.\\\\3A hover\\\\3A focus\\\\3A active--cdd1dd345eead04fd4df { background: lime; }
5685+
.\\\\[attr\\\\=value\\\\]--c62830d38d8d716893eb { background: lime; }
5686+
.f\\\\/o\\\\/o--fbca7ba56e09ecbbc62c { background: lime; }
5687+
.f\\\\\\\\o\\\\\\\\o--d45f79a6d98695cdf7b8 { background: lime; }
5688+
.f\\\\*o\\\\*o--a40517bd0d8d54cdf2e9 { background: lime; }
5689+
.f\\\\!o\\\\!o--ca15427719be1c4d9202 { background: lime; }
5690+
.f\\\\'o\\\\'o--d66cc50b7a1d7fea63dc { background: lime; }
5691+
.f\\\\~o\\\\~o--b87d149677e776a8f870 { background: lime; }
5692+
.f\\\\+o\\\\+o--cac6afc7828cdeec9b8e { background: lime; }
5693+
5694+
.foo\\\\/bar--f18e2cdd363bb8ad04dc {
5695+
background: hotpink;
5696+
}
5697+
5698+
.foo\\\\\\\\bar--b7fb1775501d478f7ddd {
5699+
background: hotpink;
5700+
}
5701+
5702+
.foo\\\\/bar\\\\/baz--e770299577106c0871c6 {
5703+
background: hotpink;
5704+
}
5705+
5706+
.foo\\\\\\\\bar\\\\\\\\baz--f06100a42cf29105670c {
5707+
background: hotpink;
5708+
}
5709+
",
5710+
"",
5711+
],
5712+
]
5713+
`;
5714+
5715+
exports[`"modules" option should work with "localIdentHashFunction" xxhash64: warnings 1`] = `Array []`;
5716+
55295717
exports[`"modules" option should work with "url" and "namedExport": errors 1`] = `Array []`;
55305718

55315719
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
@@ -225,6 +225,25 @@ describe('"modules" option', () => {
225225
expect(getErrors(stats)).toMatchSnapshot("errors");
226226
});
227227

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

0 commit comments

Comments
 (0)