cuth / cuth/postcss-pxtorem

problem in vite: isExcludeFile may not be correctly set

Open
#85 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.2k
Forks
173
PR merge metrics
No merged PRs in 30d

Description

Part of my vite.config.js:
```
import postCssPxToRem from 'postcss-pxtorem'
{
...,
css: {
postcss: {
plugins: [
postCssPxToRem({
rootValue: 16,
propList: ['*'],
exclude: function (file) { return file.indexOf('Register') === -1; },
}),
{
postcssPlugin: 'internal:charset-removal',
AtRule: {
charset: (atRule) => {
if (atRule.name === 'charset') {
atRule.remove();
}
}
}
},
]
}
}
}
```
Once and Declaration callback execution order can be like this:
```
filePath: Register.vue
transforming (652) node_modules\@babel\runtime\helpers\esm\defineProperty.js
filePath: List.vue
transforming (671) node_modules\ant-design-vue\es\_util\warning.js
filePath: Risk.vue
filePath: Verify.vue
filePath: Role.vue
transforming (687) node_modules\ant-design-vue\es\_util\vnode.js
filePath: Detail.vue

Register.vue declaration:
Declaration {
raws: { before: '\n ', between: ': ' },
type: 'decl',
parent: Rule {
raws: { before: '\n\n', between: ' ', semicolon: true, after: '\n' },
type: 'rule',
nodes: [ [Circular *1], [Declaration], [Declaration], [Declaration] ],
parent: Root {
raws: [Object],
type: 'root',
nodes: [Array],
source: [Object],
lastEach: 2,
indexes: [Object],
[Symbol(isClean)]: false,
[Symbol(my)]: true
},
source: { start: [Object], input: [Input], end: [Object] },
selector: '.pife1-card',
lastEach: 2,
indexes: { '2': 1 },
[Symbol(isClean)]: true,
[Symbol(my)]: true
},
...
```
In my case, i just want to include Register.vue and exclude all other files. However, if Once callback is not directly followed by corresponding Declaration callback, isExcludeFile would be true, it's not as what i expected.
I have glanced at all issues, but i didn't got a similar one.
I’d appreciate some help.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.