Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ export const LessStylesheetLanguage = Object.freeze<StylesheetLanguage>({
componentFilter: /^less;/,
fileFilter: /\.less$/,
process(data, file, _, options, build) {
return compileString(
data,
file,
options,
build.resolve.bind(build),
/* unsafeInlineJavaScript */ false,
);
return compileString(data, file, options, build.resolve.bind(build));
},
});

Expand All @@ -47,7 +41,6 @@ async function compileString(
filename: string,
options: StylesheetPluginOptions,
resolver: PluginBuild['resolve'],
unsafeInlineJavaScript: boolean,
): Promise<OnLoadResult> {
try {
lessPreprocessor ??= (await import('less')).default;
Expand Down Expand Up @@ -118,7 +111,6 @@ async function compileString(
paths: options.includePaths,
plugins: [resolverPlugin],
rewriteUrls: 'all',
javascriptEnabled: unsafeInlineJavaScript,
sourceMap: options.sourcemap
? {
sourceMapFileInline: true,
Expand All @@ -136,35 +128,6 @@ async function compileString(
if (isLessException(error)) {
const location = convertExceptionLocation(error);

// Retry with a warning for less files requiring the deprecated inline JavaScript option
if (error.message.includes('Inline JavaScript is not enabled.')) {
const withJsResult = await compileString(
data,
filename,
options,
resolver,
/* unsafeInlineJavaScript */ true,
);
withJsResult.warnings = [
{
text: 'Deprecated inline execution of JavaScript has been enabled ("javascriptEnabled")',
location,
notes: [
{
location: null,
text: 'JavaScript found within less stylesheets may be executed at build time. [https://lesscss.org/usage/#less-options]',
},
{
location: null,
text: 'Support for "javascriptEnabled" may be removed from the Angular CLI starting with Angular v19.',
},
],
},
];

return withJsResult;
}

return {
errors: [
{
Expand Down