Skip to content

Commit 9c3268d

Browse files
committed
continue to fix ant-design#4935
1 parent 55fca5c commit 9c3268d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/prepub.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ if (fs.existsSync(path.join(__dirname, '../lib'))) {
1616
versionFilePath,
1717
versionFileContent.replace(`require('../../package.json')`, `{ version: '${packageInfo.version}' }`)
1818
);
19+
console.log('Wrote version into lib/version/index.js');
1920

2021
// Build package.json version to lib/version/index.d.ts
2122
// prevent https://github.com/ant-design/ant-design/issues/4935
2223
const versionDefPath = path.join(process.cwd(), 'lib', 'version', 'index.d.ts');
23-
const versionDefContent = fs.readFileSync(versionDefPath).toString();
2424
fs.writeFileSync(
2525
versionDefPath,
26-
versionDefContent.replace(`require('../../package.json')`, `{ version: '${packageInfo.version}' }`)
26+
`declare var _default: "${packageInfo.version}";\nexport default _default;\n`
2727
);
28+
console.log('Wrote version into lib/version/index.d.ts');
2829
}
2930

3031
if (fs.existsSync(path.join(__dirname, '../dist'))) {
3132
// Build a entry less file to dist/antd.less
32-
console.log('Building a entry less file to dist/antd.less');
3333
const componentsPath = path.join(process.cwd(), 'components');
3434
let componentsLessContent = '';
3535

@@ -48,4 +48,5 @@ if (fs.existsSync(path.join(__dirname, '../dist'))) {
4848
'@import "../lib/style/index.less";\n@import "../lib/style/components.less";'
4949
);
5050
});
51+
console.log('Built a entry less file to dist/antd.less');
5152
}

0 commit comments

Comments
 (0)