@xfe-repo/mini-app 0.0.7 → 0.0.9

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/config/dev.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { UserConfigExport } from "@tarojs/cli";
2
2
  import RoutesDefineWebpackPlugin from "@xfe-repo/routes-define-webpack-plugin";
3
- import { appProjectSrcPath } from ".";
3
+ import path from 'path'
4
+ import { appProjectRootRelPath } from ".";
4
5
 
5
6
  export default {
6
7
  env: {
@@ -17,7 +18,7 @@ export default {
17
18
  {
18
19
  routePrefix: 'pages',
19
20
  routeSuffix: 'index',
20
- outputPath: appProjectSrcPath,
21
+ outputPath: path.join(appProjectRootRelPath, 'src'),
21
22
  },
22
23
  ])
23
24
  },
@@ -29,7 +30,7 @@ export default {
29
30
  {
30
31
  routePrefix: 'pages',
31
32
  routeSuffix: 'index',
32
- outputPath: appProjectSrcPath,
33
+ outputPath: path.join(appProjectRootRelPath, 'src'),
33
34
  },
34
35
  ])
35
36
  },
package/config/index.ts CHANGED
@@ -5,13 +5,14 @@ import devConfig from './dev'
5
5
  import prodConfig from './prod'
6
6
 
7
7
  // 获取APP_PROJECT_ROOT相对于当前文件的路径
8
- export const appProjectRootRelPath = path.relative(path.join(__dirname, '..'), process.env.APP_PROJECT_ROOT || '')
9
- export const appProjectSrcPath = path.join(appProjectRootRelPath, 'src')
10
- export const appProjectDistPath = path.join(appProjectRootRelPath, 'dist')
8
+ export const appProjectRootAbsPath = process.env.APP_PROJECT_ROOT || ''
9
+ export const appProjectRootRelPath = path.relative(path.join(__dirname, '..'), appProjectRootAbsPath)
11
10
 
12
11
  // 获取API_ENV环境变量 此处注意 需要stringify为带引号的字符串 这样在webpack中才能正确解析
13
12
  export const API_ENV = JSON.stringify(process.env.API_ENV || '')
14
13
 
14
+ console.log('aaaaaa', path.resolve(appProjectRootRelPath, './src'))
15
+
15
16
  export default defineConfig<'webpack5'>(async (merge) => {
16
17
  const baseConfig: UserConfigExport<'webpack5'> = {
17
18
  projectName: 'xfe-mini',
@@ -23,13 +24,18 @@ export default defineConfig<'webpack5'>(async (merge) => {
23
24
  375: 2,
24
25
  828: 1.81 / 2
25
26
  },
26
- sourceRoot: appProjectSrcPath,
27
- outputRoot: appProjectDistPath,
27
+ // 项目根目录 相对于当前文件
28
+ sourceRoot: path.join(appProjectRootRelPath, 'src'),
29
+ // 项目输出 相对于当前文件
30
+ outputRoot: path.join(appProjectRootRelPath, 'dist'),
28
31
  env: {
29
32
  API_ENV
30
33
  },
34
+ // 别名 需要注意 此处需要提供绝对路径
31
35
  alias: {
32
- react: path.resolve(appProjectRootRelPath, './node_modules/react')
36
+ react: path.join(appProjectRootAbsPath, 'node_modules/react'),
37
+ "@": path.join(appProjectRootAbsPath, 'src'),
38
+ "@common/services": "@xfe-repo/mini-service",
33
39
  },
34
40
  plugins: [],
35
41
  defineConstants: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xfe-repo/mini-app",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "bin": {
5
5
  "xfe-mini": "./bin/index.js"
6
6
  },
@@ -51,7 +51,7 @@
51
51
  "typescript": "^5.4.5",
52
52
  "webpack": "5.91.0",
53
53
  "yaml": "^2.3.4",
54
- "@xfe-repo/routes-define-webpack-plugin": "0.0.2"
54
+ "@xfe-repo/routes-define-webpack-plugin": "0.0.3"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "react": "18.2.0",
package/tsconfig.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "extends": "@xfe-repo/typescript-config/react.json",
3
3
  "compilerOptions": {
4
- "baseUrl": "src",
5
4
  "paths": {
5
+ "@/*": ["./*"],
6
6
  "@common/services": ["../node_modules/@xfe-repo/mini-service/dist/index"],
7
7
  }
8
8
  },