mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 13:55:04 +02:00
Update to angular 20
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { transformAsync } from '@babel/core';
|
||||
import linkerPlugin from '@angular/compiler-cli/linker/babel';
|
||||
import { needsLinking } from '@angular/compiler-cli/linker';
|
||||
|
||||
export default function angularLinkerLoader(content, map) {
|
||||
const callback = this.async();
|
||||
(async () => {
|
||||
try {
|
||||
const filename = this.resourcePath;
|
||||
if (!needsLinking(filename, content)) {
|
||||
callback(null, content, map);
|
||||
return;
|
||||
}
|
||||
// Create a fresh plugin instance per file. The linker plugin is stateful
|
||||
// and cannot be shared across concurrent transforms.
|
||||
const { code, map: resultMap } = await transformAsync(content, {
|
||||
filename,
|
||||
sourceFileName: filename,
|
||||
sourceMaps: !!this.sourceMap,
|
||||
compact: false,
|
||||
plugins: [api => linkerPlugin(api, { sourceMapping: false })],
|
||||
});
|
||||
callback(null, code, resultMap || undefined);
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
}
|
||||
})();
|
||||
}
|
||||
Reference in New Issue
Block a user