Skip to content

Commit c4037b0

Browse files
refactor: reuing ast
1 parent d49b1db commit c4037b0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,13 @@ export default function loader(content, map, meta) {
4545
}),
4646
];
4747

48-
let contentOrAst = content;
49-
5048
// Reuse CSS AST (PostCSS AST e.g 'postcss-loader') to avoid reparsing
5149
if (meta) {
5250
const { ast } = meta;
5351

5452
if (ast && ast.type === 'postcss') {
55-
contentOrAst = ast.root;
53+
// eslint-disable-next-line no-param-reassign
54+
content = ast.root;
5655
}
5756
}
5857

@@ -71,7 +70,7 @@ export default function loader(content, map, meta) {
7170
}
7271

7372
postcss(plugins)
74-
.process(contentOrAst, {
73+
.process(content, {
7574
// We need a prefix to avoid path rewriting of PostCSS
7675
from: `/css-loader!${getRemainingRequest(this)
7776
.split('!')

0 commit comments

Comments
 (0)