加入width的判断
This commit is contained in:
parent
aa535ccd01
commit
b64038f2f2
|
|
@ -19,11 +19,10 @@ module.exports = (babel) => {
|
|||
const { cwd, filename } = state;
|
||||
const rel = relative(cwd, filename).replace(/\\/g, '/');
|
||||
if (/(pages|components)[\w|\W]+(index\.tsx|index\.pc\.tsx)$/.test(rel)) {
|
||||
const lessFile = filename.replace(/\.ts$/, '.less');
|
||||
const lessFile = filename.replace(/\.(ts|tsx)$/, '.less');
|
||||
const lessFileExists = fs.existsSync(lessFile);
|
||||
const pcLessFile = filename.replace(/\.ts$/, '.pc.less');
|
||||
const pcLessFile = filename.replace(/\.(ts|tsx)$/, '.pc.less');
|
||||
const pcLessFileExists = fs.existsSync(pcLessFile);
|
||||
|
||||
const { body } = path.node;
|
||||
const lessFileImport = rel.endsWith('.pc.tsx') ?
|
||||
(pcLessFileExists ? './index.pc.less' : './index.less') :
|
||||
|
|
|
|||
|
|
@ -83,13 +83,16 @@ module.exports = (babel) => {
|
|||
if (tsxFileExists && pcTsxFileExists) {
|
||||
statements.push(
|
||||
t.ifStatement(
|
||||
t.booleanLiteral(true),
|
||||
t.blockStatement(
|
||||
renderStatements
|
||||
t.binaryExpression(
|
||||
'===',
|
||||
t.memberExpression(
|
||||
t.memberExpression(t.thisExpression(), t.identifier('props')),
|
||||
t.identifier('width')
|
||||
),
|
||||
t.stringLiteral('xs')
|
||||
),
|
||||
t.blockStatement(
|
||||
renderPcStatements
|
||||
)
|
||||
t.blockStatement(renderStatements),
|
||||
t.blockStatement(renderPcStatements)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,16 +26,19 @@ const publicUrlOrPath = getPublicUrlOrPath(
|
|||
const buildPath = process.env.BUILD_PATH || 'build';
|
||||
|
||||
let moduleFileExtensions = [
|
||||
'web.mjs',
|
||||
'mjs',
|
||||
'web.js',
|
||||
'js',
|
||||
'web.ts',
|
||||
'ts',
|
||||
'web.tsx',
|
||||
'tsx',
|
||||
'web.jsx',
|
||||
'jsx',
|
||||
'web.mjs',
|
||||
'mjs',
|
||||
'web.js',
|
||||
'js',
|
||||
'web.ts',
|
||||
'pc.ts',
|
||||
'ts',
|
||||
'web.tsx',
|
||||
'pc.tsx',
|
||||
'tsx',
|
||||
'web.jsx',
|
||||
'pc.jsx',
|
||||
'jsx',
|
||||
];
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
moduleFileExtensions = [
|
||||
|
|
|
|||
Loading…
Reference in New Issue