@pz4l/tinyimg-unplugin 0.1.0-beta.0 → 0.1.1-beta.1

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.
Files changed (2) hide show
  1. package/README.md +66 -6
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -16,6 +16,24 @@
16
16
  npm install @pz4l/tinyimg-unplugin -D
17
17
  ```
18
18
 
19
+ ### Testing Installation
20
+
21
+ To verify the package installs correctly without workspace dependency errors:
22
+
23
+ ```bash
24
+ # Test in a clean directory outside the monorepo
25
+ cd /tmp
26
+ mkdir test-tinyimg && cd test-tinyimg
27
+ pnpm init
28
+ pnpm add @pz4l/tinyimg-unplugin@latest
29
+
30
+ # Verify installation
31
+ pnpm list @pz4l/tinyimg-unplugin @pz4l/tinyimg-core
32
+
33
+ # Check that dependencies are resolved (no workspace:* protocol)
34
+ cat node_modules/@pz4l/tinyimg-unplugin/package.json | grep dependencies
35
+ ```
36
+
19
37
  ## Environment Setup
20
38
 
21
39
  ### TINYPNG_KEYS 环境变量
@@ -37,22 +55,64 @@ export TINYPNG_KEYS=key1,key2,key3
37
55
 
38
56
  ### 在项目中配置环境变量
39
57
 
40
- **Vite 项目**(`.env` 文件):
58
+ #### Vite 项目
59
+
60
+ 创建 `.env` 文件:
61
+
62
+ ```bash
63
+ TINYPNG_KEYS=your_api_key_here
64
+ ```
65
+
66
+ Vite 会自动加载 `.env` 文件,无需额外配置。
67
+
68
+ #### Webpack 项目
69
+
70
+ 创建 `.env` 文件:
41
71
 
42
72
  ```bash
43
73
  TINYPNG_KEYS=your_api_key_here
44
74
  ```
45
75
 
46
- **Webpack 项目**(`webpack.config.js`):
76
+ 安装 dotenv-webpack 插件:
77
+
78
+ ```bash
79
+ npm install dotenv-webpack -D
80
+ ```
81
+
82
+ 在 `webpack.config.js` 中配置:
47
83
 
48
84
  ```javascript
49
- const webpack = require('webpack')
85
+ const Dotenv = require('dotenv-webpack')
50
86
 
51
87
  module.exports = {
52
88
  plugins: [
53
- new webpack.DefinePlugin({
54
- 'process.env.TINYPNG_KEYS': JSON.stringify('your_api_key_here')
55
- })
89
+ new Dotenv()
90
+ ]
91
+ }
92
+ ```
93
+
94
+ #### Rolldown 项目
95
+
96
+ 创建 `.env` 文件:
97
+
98
+ ```bash
99
+ TINYPNG_KEYS=your_api_key_here
100
+ ```
101
+
102
+ 安装 @rollup/plugin-dotsenv 插件:
103
+
104
+ ```bash
105
+ npm install @rollup/plugin-dotsenv -D
106
+ ```
107
+
108
+ 在 `rolldown.config.js` 中配置:
109
+
110
+ ```javascript
111
+ import dotsenv from '@rollup/plugin-dotsenv'
112
+
113
+ export default {
114
+ plugins: [
115
+ dotsenv()
56
116
  ]
57
117
  }
58
118
  ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pz4l/tinyimg-unplugin",
3
3
  "type": "module",
4
- "version": "0.1.0-beta.0",
4
+ "version": "0.1.1-beta.1",
5
5
  "description": "unplugin for automatic image compression during build (Vite, Webpack, Rolldown)",
6
6
  "author": "pzehrel",
7
7
  "license": "MIT",
@@ -62,7 +62,7 @@
62
62
  "dependencies": {
63
63
  "micromatch": "^4.0.8",
64
64
  "unplugin": "^1.0.0",
65
- "@pz4l/tinyimg-core": "0.1.0-beta.0"
65
+ "@pz4l/tinyimg-core": "0.1.1-beta.1"
66
66
  },
67
67
  "devDependencies": {
68
68
  "fast-glob": "^3.3.3",