@lark-apaas/miaoda-presets 0.1.0-alpha.4 → 0.1.0-alpha.5

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.
@@ -13,7 +13,11 @@ const eslint_1 = __importDefault(require("./recommend/eslint"));
13
13
  const importPlugin = require('eslint-plugin-import');
14
14
  function createEslintConfig() {
15
15
  return typescript_eslint_1.default.config({ ignores: ['dist', 'node_modules', 'build'] }, {
16
- extends: [js_1.default.configs.recommended, eslint_1.default, ...typescript_eslint_1.default.configs.recommended],
16
+ extends: [
17
+ js_1.default.configs.recommended,
18
+ eslint_1.default,
19
+ ...typescript_eslint_1.default.configs.recommended,
20
+ ],
17
21
  files: ['src/**/*.{ts,tsx}'],
18
22
  languageOptions: {
19
23
  ecmaVersion: 2020,
@@ -58,7 +58,7 @@ function loadScriptsWithDeps() {
58
58
  // Create loading promise for this script
59
59
  const loadingPromise = Promise.all(
60
60
  // Map dependencies to promises
61
- script.deps.map((dep) => loadWithDeps(dep)))
61
+ script.deps.map(dep => loadWithDeps(dep)))
62
62
  .then(() => {
63
63
  // After all dependencies are loaded, load this script
64
64
  return loadScript(script.src);
@@ -73,7 +73,7 @@ function loadScriptsWithDeps() {
73
73
  return loadingPromise;
74
74
  }
75
75
  // Load all scripts
76
- return Promise.all(Object.keys(scripts).map((name) => loadWithDeps(name)));
76
+ return Promise.all(Object.keys(scripts).map(name => loadWithDeps(name)));
77
77
  }
78
78
  // Start loading all scripts
79
79
  window.__FEISUDA_SCRIPTS_LOADED__ = loadScriptsWithDeps();
@@ -69,7 +69,9 @@ function createRecommendRspackConfig(options) {
69
69
  },
70
70
  },
71
71
  },
72
- ...(isDev ? [require.resolve('@lark-apaas/miaoda-inspector-babel-plugin')] : []),
72
+ ...(isDev
73
+ ? [require.resolve('@lark-apaas/miaoda-inspector-babel-plugin')]
74
+ : []),
73
75
  ],
74
76
  },
75
77
  ],
@@ -94,7 +96,7 @@ function createRecommendRspackConfig(options) {
94
96
  maxChunks: 1,
95
97
  }),
96
98
  ],
97
- optimization: {
99
+ optimization: isDev ? {} : {
98
100
  moduleIds: 'deterministic',
99
101
  concatenateModules: true,
100
102
  minimize: true, // 对应vite的minify配置
@@ -24,7 +24,10 @@ function createRspackConfig(options) {
24
24
  echarts: 'echarts',
25
25
  }
26
26
  : {};
27
- const recommendConfig = (0, rspack_1.createRecommendRspackConfig)({ enableReactRrefresh, isDev });
27
+ const recommendConfig = (0, rspack_1.createRecommendRspackConfig)({
28
+ enableReactRrefresh,
29
+ isDev,
30
+ });
28
31
  return (0, webpack_merge_1.default)(recommendConfig, {
29
32
  mode: isDev ? 'development' : 'production',
30
33
  entry: './src/index.tsx',
@@ -33,13 +36,15 @@ function createRspackConfig(options) {
33
36
  // path: path.resolve(__dirname, 'dist'),
34
37
  filename: 'assets/index.js',
35
38
  cssFilename: 'assets/index.css',
36
- assetModuleFilename: (pathData) => {
39
+ assetModuleFilename: pathData => {
37
40
  // 对应vite的assetFileNames逻辑
38
41
  const ext = path_1.default.extname(pathData.filename || '');
39
42
  if (ext === '.css') {
40
43
  return 'assets/index.css';
41
44
  }
42
- return pathData.filename ? `assets/${pathData.filename}` : 'assets/asset-[hash][ext]';
45
+ return pathData.filename
46
+ ? `assets/${pathData.filename}`
47
+ : 'assets/asset-[hash][ext]';
43
48
  },
44
49
  library: {
45
50
  type: 'self', // 对应vite的iife格式
@@ -8,7 +8,9 @@ const webpack_merge_1 = __importDefault(require("webpack-merge"));
8
8
  const tailwind_1 = require("./recommend/tailwind");
9
9
  function createTailwindConfig(options) {
10
10
  const { isDevBuildMode = true } = options;
11
- const recommendConfig = (0, tailwind_1.createRecommendTailwindConfig)({ isDev: isDevBuildMode });
11
+ const recommendConfig = (0, tailwind_1.createRecommendTailwindConfig)({
12
+ isDev: isDevBuildMode,
13
+ });
12
14
  return (0, webpack_merge_1.default)(recommendConfig, {
13
15
  content: ['./src/**/*.{ts,tsx}'],
14
16
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-presets",
3
- "version": "0.1.0-alpha.4",
3
+ "version": "0.1.0-alpha.5",
4
4
  "files": [
5
5
  "lib"
6
6
  ],