File tree 3 files changed +8
-6
lines changed
packages/ngtools/webpack/src 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 8
8
9
9
import type { Compilation , LoaderContext } from 'webpack' ;
10
10
11
+ export const InlineAngularResourceLoaderPath = __filename ;
12
+
11
13
export const InlineAngularResourceSymbol = Symbol ( '@ngtools/webpack[angular-resource]' ) ;
12
14
13
15
export interface CompilationWithInlineAngularResource extends Compilation {
Original file line number Diff line number Diff line change @@ -10,11 +10,12 @@ import { createHash } from 'crypto';
10
10
import * as path from 'path' ;
11
11
import * as vm from 'vm' ;
12
12
import type { Asset , Compilation } from 'webpack' ;
13
+ import { normalizePath } from './ivy/paths' ;
13
14
import {
14
15
CompilationWithInlineAngularResource ,
16
+ InlineAngularResourceLoaderPath ,
15
17
InlineAngularResourceSymbol ,
16
- } from './inline-data-loader' ;
17
- import { normalizePath } from './ivy/paths' ;
18
+ } from './loaders/inline-resource' ;
18
19
19
20
interface CompilationOutput {
20
21
content : string ;
@@ -33,7 +34,7 @@ export class WebpackResourceLoader {
33
34
private modifiedResources = new Set < string > ( ) ;
34
35
private outputPathCounter = 1 ;
35
36
36
- private readonly inlineDataLoaderPath = require . resolve ( './inline-data-loader' ) ;
37
+ private readonly inlineDataLoaderPath = InlineAngularResourceLoaderPath ;
37
38
38
39
constructor ( shouldCache : boolean ) {
39
40
if ( shouldCache ) {
Original file line number Diff line number Diff line change 7
7
*/
8
8
9
9
import * as ts from 'typescript' ;
10
-
11
- const inlineDataLoaderPath = require . resolve ( '../inline-data-loader' ) ;
10
+ import { InlineAngularResourceLoaderPath } from '../loaders/inline-resource' ;
12
11
13
12
export function replaceResources (
14
13
shouldTransform : ( fileName : string ) => boolean ,
@@ -208,7 +207,7 @@ function visitComponentMetadata(
208
207
} else if ( inlineStyleFileExtension ) {
209
208
const data = Buffer . from ( node . text ) . toString ( 'base64' ) ;
210
209
const containingFile = node . getSourceFile ( ) . fileName ;
211
- url = `${ containingFile } .${ inlineStyleFileExtension } !=!${ inlineDataLoaderPath } ?data=${ encodeURIComponent (
210
+ url = `${ containingFile } .${ inlineStyleFileExtension } !=!${ InlineAngularResourceLoaderPath } ?data=${ encodeURIComponent (
212
211
data ,
213
212
) } !${ containingFile } `;
214
213
} else {
You can’t perform that action at this time.
0 commit comments