Browse Source

build: add entry to dist css files for the dark theme

pull/20117/head
PeachScript 5 years ago
parent
commit
c7c5e43e6d
  1. 2
      index-dark.js
  2. 1
      package.json
  3. 12
      webpack.config.js

2
index-dark.js

@ -0,0 +1,2 @@
require('./components/style/dark.less');
require('./index');

1
package.json

@ -196,6 +196,7 @@
"glob": "^7.1.4",
"http-server": "^0.12.0",
"husky": "^3.0.2",
"ignore-emit-webpack-plugin": "^2.0.2",
"immutability-helper": "^3.0.0",
"intersection-observer": "^0.7.0",
"jest": "^24.8.0",

12
webpack.config.js

@ -2,6 +2,7 @@
// This config is for building dist files
const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig');
const PacktrackerPlugin = require('@packtracker/webpack-plugin');
const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin');
const { webpack } = getWebpackConfig;
@ -21,6 +22,16 @@ function addLocales(webpackConfig) {
webpackConfig.output.filename = '[name].js';
}
function addDarkTheme(webpackConfig) {
let packageName = 'antd-dark';
if (webpackConfig.entry['antd.min']) {
packageName += '.min';
}
webpackConfig.entry[packageName] = './index-dark.js';
webpackConfig.output.filename = '[name].js';
webpackConfig.plugins.push(new IgnoreEmitPlugin(/dark(.min)?\.js(\.map)?$/));
}
function externalMoment(config) {
config.externals.moment = {
root: 'moment',
@ -36,6 +47,7 @@ if (process.env.RUN_ENV === 'PRODUCTION') {
ignoreMomentLocale(config);
externalMoment(config);
addLocales(config);
addDarkTheme(config);
// skip codesandbox ci
if (!process.env.CSB_REPO) {
// https://docs.packtracker.io/uploading-your-webpack-stats/webpack-plugin

Loading…
Cancel
Save