Skip to content

Commit

Permalink
fix(@angular-devkit/build-optimizer): support windows paths in rollup…
Browse files Browse the repository at this point in the history
… plugin
  • Loading branch information
filipesilva authored and kyliau committed Jan 11, 2019
1 parent 5ca3523 commit a832b9a
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -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,
});
Expand Down

0 comments on commit a832b9a

Please sign in to comment.