|
|
@@ -1,41 +1,72 @@
|
|
|
-const { injectBabelPlugin } = require('react-app-rewired')
|
|
|
+const {
|
|
|
+ override,
|
|
|
+ fixBabelImports,
|
|
|
+ addLessLoader,
|
|
|
+ addWebpackAlias
|
|
|
+} = require(
|
|
|
+ 'customize-cra')
|
|
|
const rewireLess = require('react-app-rewire-less')
|
|
|
const path = require('path')
|
|
|
|
|
|
-module.exports = function override (config, env) {
|
|
|
+//执行npm run build不产生map文件
|
|
|
+process.env.GENERATE_SOURCEMAP = 'false'
|
|
|
|
|
|
- config = injectBabelPlugin(
|
|
|
- [
|
|
|
- 'import',
|
|
|
- {
|
|
|
- libraryName: 'antd',
|
|
|
- libraryDirectory: 'es',
|
|
|
- style: true,
|
|
|
- }, 'ant',
|
|
|
- ],
|
|
|
- config,
|
|
|
- )
|
|
|
+module.exports = override(
|
|
|
+ fixBabelImports('import-antd', {
|
|
|
+ libraryName: 'antd',
|
|
|
+ libraryDirectory: 'es',
|
|
|
+ style: true,
|
|
|
+ }),
|
|
|
|
|
|
- config = injectBabelPlugin(
|
|
|
- [
|
|
|
- 'import',
|
|
|
- {
|
|
|
- libraryName: 'antd-mobile',
|
|
|
- libraryDirectory: 'lib',
|
|
|
- style: true,
|
|
|
- }, 'ant-mobile',
|
|
|
- ],
|
|
|
- config,
|
|
|
- )
|
|
|
+ fixBabelImports('import-ant-mobile', {
|
|
|
+ libraryName: 'antd-mobile',
|
|
|
+ libraryDirectory: 'lib',
|
|
|
+ style: true,
|
|
|
+ }),
|
|
|
|
|
|
- config = rewireLess.withLoaderOptions({
|
|
|
- modifyVars: { '@primary-color': '#1DA57A' },
|
|
|
+ addLessLoader({
|
|
|
javascriptEnabled: true,
|
|
|
- })(config, env)
|
|
|
+ modifyVars: { '@primary-color': '#1DA57A' },
|
|
|
+ }),
|
|
|
|
|
|
- config.resolve.alias = {
|
|
|
+ addWebpackAlias({
|
|
|
'@': path.join(__dirname, './src'),
|
|
|
- }
|
|
|
-
|
|
|
- return config
|
|
|
-}
|
|
|
+ })
|
|
|
+)
|
|
|
+// module.exports = function override (config, env) {
|
|
|
+//
|
|
|
+// config = injectBabelPlugin(
|
|
|
+// [
|
|
|
+// 'import',
|
|
|
+// {
|
|
|
+// libraryName: 'antd',
|
|
|
+// libraryDirectory: 'es',
|
|
|
+// style: true,
|
|
|
+// }, 'ant',
|
|
|
+// ],
|
|
|
+// config,
|
|
|
+// )
|
|
|
+//
|
|
|
+// config = injectBabelPlugin(
|
|
|
+// [
|
|
|
+// 'import',
|
|
|
+// {
|
|
|
+// libraryName: 'antd-mobile',
|
|
|
+// libraryDirectory: 'lib',
|
|
|
+// style: true,
|
|
|
+// }, 'ant-mobile',
|
|
|
+// ],
|
|
|
+// config,
|
|
|
+// )
|
|
|
+//
|
|
|
+// config = rewireLess.withLoaderOptions({
|
|
|
+// modifyVars: { '@primary-color': '#1DA57A' },
|
|
|
+// javascriptEnabled: true,
|
|
|
+// })(config, env)
|
|
|
+//
|
|
|
+// config.resolve.alias = {
|
|
|
+// '@': path.join(__dirname, './src'),
|
|
|
+// }
|
|
|
+//
|
|
|
+// return config
|
|
|
+// }
|