1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var _doczPluginCssTemp = require("docz-plugin-css-temp");
|
9 |
|
10 | var _path = require("path");
|
11 |
|
12 | var _fs = require("fs");
|
13 |
|
14 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
15 |
|
16 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
17 |
|
18 | const cssModuleRegex = /\.module\.css$/;
|
19 | const lessModuleRegex = /\.module\.less$/;
|
20 | const cwd = process.cwd();
|
21 | const userConfig = JSON.parse((0, _fs.readFileSync)((0, _path.join)(cwd, '.docz', '.umirc.library.json'), 'utf-8'));
|
22 |
|
23 | var _default = _objectSpread({}, userConfig.doc, {
|
24 | modifyBundlerConfig(config, dev, args) {
|
25 | if (userConfig.modifyBundlerConfig) {
|
26 | config = userConfig.modifyBundlerConfig(config, dev, args);
|
27 | }
|
28 |
|
29 |
|
30 | config.devtool = false;
|
31 |
|
32 | if (process.env.COMPRESS === 'none') {
|
33 | config.optimization.minimize = false;
|
34 | }
|
35 |
|
36 | return config;
|
37 | },
|
38 |
|
39 | plugins: [...(userConfig.plugins || []),
|
40 | (0, _doczPluginCssTemp.css)({
|
41 | preprocessor: 'postcss',
|
42 | ruleOpts: {
|
43 | exclude: cssModuleRegex
|
44 | },
|
45 | cssmodules: false
|
46 | }), (0, _doczPluginCssTemp.css)({
|
47 | preprocessor: 'postcss',
|
48 | ruleOpts: {
|
49 | test: cssModuleRegex
|
50 | },
|
51 | cssmodules: true
|
52 | }),
|
53 | (0, _doczPluginCssTemp.css)({
|
54 | preprocessor: 'less',
|
55 | ruleOpts: {
|
56 | exclude: lessModuleRegex
|
57 | },
|
58 | cssmodules: false,
|
59 | loaderOpts: {
|
60 | javascriptEnabled: true
|
61 | }
|
62 | }), (0, _doczPluginCssTemp.css)({
|
63 | preprocessor: 'less',
|
64 | ruleOpts: {
|
65 | test: lessModuleRegex
|
66 | },
|
67 | cssmodules: true,
|
68 | loaderOpts: {
|
69 | javascriptEnabled: true
|
70 | }
|
71 | })]
|
72 | });
|
73 |
|
74 | exports.default = _default; |
\ | No newline at end of file |