From 28310e16d13dca748a8f3335b15348e551f318b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=84=9A=E9=81=93?= Date: Tue, 3 Jul 2018 20:20:09 +0800 Subject: [PATCH] remove webpackrc to config/config.js --- .gitignore | 7 ++++++- .prettierignore | 2 ++ .webpackrc.js | 46 ----------------------------------------- config/config.js | 54 +++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 59 insertions(+), 50 deletions(-) delete mode 100755 .webpackrc.js diff --git a/.gitignore b/.gitignore index 93e89407..4d66d865 100755 --- a/.gitignore +++ b/.gitignore @@ -23,9 +23,14 @@ package-lock.json jsconfig.json .vscode -# visual studio code +# visual studio code .history *.log functions/mock .temp/** + +# umi +.umi +.umi-production + diff --git a/.prettierignore b/.prettierignore index 95765e94..2098c78c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,3 +3,5 @@ **/*.ejs **/*.html package.json +.umi +.umi-production diff --git a/.webpackrc.js b/.webpackrc.js deleted file mode 100755 index c1980184..00000000 --- a/.webpackrc.js +++ /dev/null @@ -1,46 +0,0 @@ -const path = require('path'); - -export default { - entry: 'src/index.js', - extraBabelPlugins: [['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }]], - env: { - development: { - extraBabelPlugins: ['dva-hmr'], - }, - }, - externals: { - '@antv/data-set': 'DataSet', - bizcharts: 'BizCharts', - rollbar: 'rollbar', - }, - alias: { - components: path.resolve(__dirname, 'src/components/'), - }, - ignoreMomentLocale: true, - theme: './src/theme.js', - html: { - template: './src/index.ejs', - }, - publicPath: '/', - hash: true, - lessLoaderOptions: { - javascriptEnabled: true, - }, - cssLoaderOptions: { - modules: true, - getLocalIdent: (context, localIdentName, localName) => { - if ( - context.resourcePath.includes('node_modules') || - context.resourcePath.includes('ant.design.pro.less') - ) { - return localName; - } - const antdProPath = context.resourcePath.match(/src(.*)/)[1].replace('.less', ''); - const arr = antdProPath - .split('/') - .map(a => a.replace(/([A-Z])/g, '-$1')) - .map(a => a.toLowerCase()); - return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-'); - }, - }, -}; diff --git a/config/config.js b/config/config.js index ea25050c..6c3d0367 100644 --- a/config/config.js +++ b/config/config.js @@ -1,6 +1,54 @@ +/* eslint-disable react/destructuring-assignment */ + // https://umijs.org/config/ + +const path = require('path'); + export default { - plugins: [ - 'umi-plugin-dva', - ], + plugins: ['umi-plugin-dva'], + + // TODO remove + // entry: 'src/index.js', + extraBabelPlugins: [['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }]], + env: { + development: { + extraBabelPlugins: ['dva-hmr'], + }, + }, + externals: { + '@antv/data-set': 'DataSet', + bizcharts: 'BizCharts', + rollbar: 'rollbar', + }, + alias: { + components: path.resolve(__dirname, 'src/components/'), + }, + ignoreMomentLocale: true, + theme: './src/theme.js', + html: { + template: './src/index.ejs', + }, + publicPath: '/', + // TODO check hash config + // hash: true, + lessLoaderOptions: { + javascriptEnabled: true, + }, + cssLoaderOptions: { + modules: true, + getLocalIdent: (context, localIdentName, localName) => { + if ( + context.resourcePath.includes('node_modules') || + context.resourcePath.includes('ant.design.pro.less') + ) { + return localName; + } + const antdProPath = context.resourcePath.match(/src(.*)/)[1].replace('.less', ''); + const arr = antdProPath + .split('/') + .map(a => a.replace(/([A-Z])/g, '-$1')) + .map(a => a.toLowerCase()); + return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-'); + }, + }, }; -- GitLab