File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
packages/ngtools/webpack/src/ivy Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import * as path from 'path';
1010import type { LoaderContext } from 'webpack' ;
1111import { AngularPluginSymbol , FileEmitterCollection } from './symbol' ;
1212
13+ const JS_FILE_REGEXP = / \. [ c m ] ? j s $ / ;
14+
1315export function angularWebpackLoader ( this : LoaderContext < unknown > , content : string , map : string ) {
1416 const callback = this . async ( ) ;
1517 if ( ! callback ) {
@@ -20,7 +22,7 @@ export function angularWebpackLoader(this: LoaderContext<unknown>, content: stri
2022 this as LoaderContext < unknown > & { [ AngularPluginSymbol ] ?: FileEmitterCollection }
2123 ) [ AngularPluginSymbol ] ;
2224 if ( ! fileEmitter || typeof fileEmitter !== 'object' ) {
23- if ( this . resourcePath . endsWith ( '.js' ) ) {
25+ if ( JS_FILE_REGEXP . test ( this . resourcePath ) ) {
2426 // Passthrough for JS files when no plugin is used
2527 this . callback ( undefined , content , map ) ;
2628
@@ -36,7 +38,7 @@ export function angularWebpackLoader(this: LoaderContext<unknown>, content: stri
3638 . emit ( this . resourcePath )
3739 . then ( ( result ) => {
3840 if ( ! result ) {
39- if ( this . resourcePath . endsWith ( '.js' ) ) {
41+ if ( JS_FILE_REGEXP . test ( this . resourcePath ) ) {
4042 // Return original content for JS files if not compiled by TypeScript ("allowJs")
4143 this . callback ( undefined , content , map ) ;
4244 } else {
You can’t perform that action at this time.
0 commit comments