Skip to content

Commit cb4e461

Browse files
committed
fix uitls
1 parent f98c328 commit cb4e461

File tree

3 files changed

+39
-8
lines changed

3 files changed

+39
-8
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,21 @@ access.setPermission('user', ['read', 'write']);
5959
const hasPermission = access.checkPermission('user', 'read');
6060
```
6161

62+
## Webpack 5 配置
63+
64+
如果你使用的是 Webpack 5,需要在你的 webpack 配置中添加以下配置:
65+
66+
```javascript
67+
module.exports = {
68+
// ... 其他配置
69+
resolve: {
70+
fallback: {
71+
"util": false
72+
}
73+
}
74+
};
75+
```
76+
6277
## 主要特性
6378

6479
- 组件总线:用于管理和注册组件

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codingapi/ui-framework",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"description": "A UI Framework built with React and Typescript",
55
"keywords": ["ui", "framework", "react", "typescript"],
66
"homepage": "https://github.com/codingapi/ui-framework",
@@ -13,6 +13,9 @@
1313
},
1414
"main": "dist/index.js",
1515
"module": "dist/index.es.js",
16+
"browser": {
17+
"util": false
18+
},
1619
"license": "Apache-2.0",
1720
"files": [
1821
"dist"

rollup.config.js

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,47 @@
1-
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
21
import resolve from '@rollup/plugin-node-resolve';
32
import commonjs from '@rollup/plugin-commonjs';
43
import typescript from 'rollup-plugin-typescript2';
54
import postcss from 'rollup-plugin-postcss';
5+
import alias from '@rollup/plugin-alias';
6+
import { nodeResolve } from '@rollup/plugin-node-resolve';
7+
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
68
import del from 'rollup-plugin-delete';
79
import pkg from './package.json';
810

911
export default {
1012
input: 'src/index.ts',
1113
output: [
1214
{
13-
file: pkg.main,
15+
file: 'dist/index.js',
1416
format: 'cjs',
1517
sourcemap: true,
1618
},
1719
{
18-
file: pkg.module,
19-
format: 'esm',
20+
file: 'dist/index.es.js',
21+
format: 'es',
2022
sourcemap: true,
2123
},
2224
],
25+
external: ['react', 'react-dom', 'util'],
2326
plugins: [
2427
del({ targets: 'dist/*' }),
2528
peerDepsExternal(),
26-
resolve(),
29+
alias({
30+
entries: [
31+
{ find: 'util', replacement: 'util/' }
32+
]
33+
}),
34+
nodeResolve({
35+
browser: true,
36+
preferBuiltins: true
37+
}),
2738
commonjs(),
2839
typescript({
29-
tsconfig: 'tsconfig.build.json',
40+
tsconfig: './tsconfig.build.json',
3041
useTsconfigDeclarationDir: true,
3142
}),
32-
postcss(),
43+
postcss({
44+
extensions: ['.css'],
45+
}),
3346
],
3447
};

0 commit comments

Comments
 (0)