mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 10:11:50 +08:00
fix(@angular-devkit/build-optimizer): support windows paths in rollup plugin
This commit is contained in:
parent
bf93f5236d
commit
f7c6719f73
@ -23,11 +23,17 @@ export interface Options {
|
||||
}
|
||||
|
||||
export default function optimizer(options: Options) {
|
||||
// Normalize paths for comparison.
|
||||
if (options.sideEffectFreeModules) {
|
||||
options.sideEffectFreeModules = options.sideEffectFreeModules.map(p => p.replace(/\\/g, '/'));
|
||||
}
|
||||
|
||||
return {
|
||||
name: 'build-optimizer',
|
||||
transform: (content: string, id: string): {code: string, map: RawSourceMap}|null => {
|
||||
const normalizedId = id.replace(/\\/g, '/');
|
||||
const isSideEffectFree = options.sideEffectFreeModules &&
|
||||
options.sideEffectFreeModules.some(m => id.indexOf(m) >= 0);
|
||||
options.sideEffectFreeModules.some(m => normalizedId.indexOf(m) >= 0);
|
||||
const { content: code, sourceMap: map } = buildOptimizer({
|
||||
content, inputFilePath: id, emitSourceMap: true, isSideEffectFree,
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user