diff --git a/index.js b/index.js index 20c18196c6..f88b5647ff 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,6 @@ -import React from 'react'; +// this file is not used if use https://github.com/ant-design/babel-plugin-antd + +const React = require('react'); const antd = { Affix: require('./components/affix'), @@ -47,10 +49,9 @@ const antd = { Cascader: require('./components/cascader'), }; -antd.version = require('./package.json').version; - -const ReactVersion = React.version; if (process.env.NODE_ENV !== 'production') { + antd.version = require('./package.json').version; + const ReactVersion = React.version; const warning = require('warning'); const semver = require('semver'); const reactVersionInDeps = require('./package.json').devDependencies.react; diff --git a/scripts/prenpm.js b/scripts/prenpm.js index 3bca6f91f6..ce17cdae54 100644 --- a/scripts/prenpm.js +++ b/scripts/prenpm.js @@ -1,18 +1,10 @@ var fs = require('fs'); var cwd = process.cwd(); var path = require('path'); -var pkg = require('../package'); - var originalIndex = fs.readFileSync(path.join(cwd, 'lib/index.js'), 'utf-8'); var newIndex = originalIndex - .replace(/\/components\//g, '/') - .replace(/require\(\'\.\/package.json\'\)/g, "require('./package')"); + .replace(/\/components\//g, '/'); fs.writeFileSync(path.join(cwd, 'lib/index.js'), newIndex, 'utf-8'); -fs.writeFileSync( - path.join(cwd, 'lib/package.js'), - "module.exports = " + JSON.stringify(require('../package.json')) + ";", - 'utf-8' -); var antdCss = path.join(cwd, 'dist/antd.css'); fs.createReadStream(antdCss) .pipe(fs.createWriteStream(path.join(cwd, 'lib/index.css')));