MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / createRequire

Function createRequire

packages/webpack5/src/polyfills/module.ts:7–28  ·  view source on GitHub ↗
(filename: string)

Source from the content-addressed store, hash-verified

5
6// Mock createRequire function that css-tree uses
7function createRequire(filename: string) {
8 // Return a mock require function
9 return function mockRequire(id: string) {
10 // Handle css-tree's internal patch.json file
11 if (id.includes('../data/patch.json') || id.includes('patch.json')) {
12 // Return css-tree's patch structure
13 return {
14 atrules: {},
15 properties: {},
16 types: {},
17 };
18 }
19
20 // For mdn-data files, return empty objects
21 if (id.includes('mdn-data')) {
22 return {};
23 }
24
25 // For any other requires, return empty object
26 return {};
27 };
28}
29
30// CommonJS export
31module.exports = {

Callers 1

Calls 1

includesMethod · 0.80

Tested by

no test coverage detected