@lark-apaas/miaoda-presets 0.1.0-alpha.11 → 0.1.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/recommend/rspack.js +2 -4
- package/lib/recommend/tailwind.js +12 -3
- package/lib/rspack.config.js +3 -3
- package/package.json +1 -1
package/lib/recommend/rspack.js
CHANGED
|
@@ -9,9 +9,7 @@ const core_1 = __importDefault(require("@rspack/core"));
|
|
|
9
9
|
const RouteParserPlugin = require('../rspack-plugins/route-parser-plugin');
|
|
10
10
|
// eslint-disable-next-line max-lines-per-function
|
|
11
11
|
function createRecommendRspackConfig(options) {
|
|
12
|
-
const {
|
|
13
|
-
console.log('isDev:', isDev);
|
|
14
|
-
console.log('enableReactRrefresh:', enableReactRrefresh);
|
|
12
|
+
const { enableReactRefresh = false, isDev = true } = options;
|
|
15
13
|
return {
|
|
16
14
|
experiments: {
|
|
17
15
|
css: true,
|
|
@@ -64,7 +62,7 @@ function createRecommendRspackConfig(options) {
|
|
|
64
62
|
}
|
|
65
63
|
: {}),
|
|
66
64
|
development: isDev,
|
|
67
|
-
refresh:
|
|
65
|
+
refresh: enableReactRefresh,
|
|
68
66
|
},
|
|
69
67
|
},
|
|
70
68
|
},
|
|
@@ -37,12 +37,21 @@ exports.createRecommendTailwindConfig = createRecommendTailwindConfig;
|
|
|
37
37
|
const path = __importStar(require("path"));
|
|
38
38
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
39
39
|
function createRecommendTailwindConfig(options) {
|
|
40
|
+
// 默认扫描外网包依赖
|
|
41
|
+
const { packageName = '@lark-apaas/miaoda-core' } = options;
|
|
42
|
+
let pkgPath = '';
|
|
43
|
+
try {
|
|
44
|
+
// 扫描依赖中的tailwind样式
|
|
45
|
+
pkgPath = path.join(path.dirname(require.resolve(packageName)), '/**/*.js');
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
console.warn(`Failed to resolve package ${packageName}, use default path`);
|
|
49
|
+
}
|
|
40
50
|
return {
|
|
41
51
|
darkMode: 'class',
|
|
42
52
|
content: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
],
|
|
53
|
+
pkgPath,
|
|
54
|
+
].filter(Boolean),
|
|
46
55
|
prefix: '',
|
|
47
56
|
plugins: [],
|
|
48
57
|
};
|
package/lib/rspack.config.js
CHANGED
|
@@ -10,9 +10,9 @@ const rspack_1 = require("./recommend/rspack");
|
|
|
10
10
|
const webpack_merge_1 = __importDefault(require("webpack-merge"));
|
|
11
11
|
// eslint-disable-next-line max-lines-per-function
|
|
12
12
|
function createRspackConfig(options) {
|
|
13
|
-
const {
|
|
13
|
+
const { enableReactRefresh = false, isDev = true } = options;
|
|
14
14
|
console.log('isDev:', isDev);
|
|
15
|
-
console.log('
|
|
15
|
+
console.log('enableReactRefresh:', enableReactRefresh);
|
|
16
16
|
// 构建外部依赖配置,对应vite的rollupOptions.external和globals
|
|
17
17
|
const externals = isDev
|
|
18
18
|
? {
|
|
@@ -25,7 +25,7 @@ function createRspackConfig(options) {
|
|
|
25
25
|
}
|
|
26
26
|
: {};
|
|
27
27
|
const recommendConfig = (0, rspack_1.createRecommendRspackConfig)({
|
|
28
|
-
|
|
28
|
+
enableReactRefresh,
|
|
29
29
|
isDev,
|
|
30
30
|
});
|
|
31
31
|
return (0, webpack_merge_1.default)(recommendConfig, {
|