MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / loader

Function loader

packages/webpack5/src/loaders/app-css-loader/index.ts:6–28  ·  view source on GitHub ↗
(content: string, map: any)

Source from the content-addressed store, hash-verified

4 * This loader tries to load an `app.scss` or and `app.css` relative to the main entry
5 */
6export default function loader(content: string, map: any) {
7 const { platform } = this.getOptions();
8 const callback = this.async();
9 const resolve = this.getResolve({
10 extensions: [`.${platform}.scss`, `.${platform}.css`, '.scss', '.css'],
11 });
12
13 resolve(this.context, './app', (err, res) => {
14 if (err || !res) {
15 // if we ran into an error or there's no css file found, we just return
16 // original content and not append any additional imports.
17 return callback(null, content, map);
18 }
19
20 const code = dedent`
21 // Added by app-css-loader
22 import "./${basename(res)}";
23 ${content}
24 `;
25
26 callback(null, code, map);
27 });
28}

Callers

nothing calls this directly

Calls 2

resolveFunction · 0.50
callbackFunction · 0.50

Tested by

no test coverage detected