You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/nano-build/README.md
+48-5
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,40 @@ Build/bundle tools for ECMAScript, TypeScript, and JavaScript libraries. It's ea
4
4
5
5
## Installation
6
6
7
+
First, install `@alwatr/nano-build` as a development dependency:
8
+
7
9
```bash
8
10
yarn add -D @alwatr/nano-build
9
11
```
10
12
13
+
## Configuration
14
+
15
+
To use `@alwatr/nano-build` in your TypeScript project, you need to configure your `tsconfig.json` file.
16
+
Below is an example configuration:
17
+
18
+
```jsonc
19
+
{
20
+
"extends":"@alwatr/tsconfig-base/tsconfig.json",
21
+
"compilerOptions": {
22
+
"rootDir":"src",
23
+
"outDir":"dist",
24
+
"emitDeclarationOnly":true,
25
+
"composite":true,
26
+
"types": ["@alwatr/nano-build"],
27
+
},
28
+
"include": ["src/**/*.ts"],
29
+
}
30
+
```
31
+
32
+
This configuration ensures that your TypeScript project is set up to use `@alwatr/nano-build` effectively, providing a streamlined build process with best practices.
33
+
11
34
## Usage
12
35
13
-
Add the following scripts to your `package.json`:
36
+
Add the following scripts to your
37
+
38
+
package.json
39
+
40
+
to use `@alwatr/nano-build`:
14
41
15
42
```json
16
43
{
@@ -39,11 +66,13 @@ Add the following scripts to your `package.json`:
39
66
splitting:false,
40
67
charset:'utf8',
41
68
legalComments:'none',
42
-
banner: {
43
-
js:"/* @package_name v@package_version */"
44
-
},
45
69
define: {
46
-
__package_version__:`'@package_version'`,
70
+
__package_name__:packageJson.name,
71
+
__package_version__:packageJson.version,
72
+
__dev_mode__:process.env.NODE_ENV!=='production',
73
+
},
74
+
banner: {
75
+
js:"/* __package_name__ v__package_version__ */"
47
76
},
48
77
}
49
78
```
@@ -142,6 +171,20 @@ Add the following scripts to your `package.json`:
142
171
}
143
172
```
144
173
174
+
### Development overwrite
175
+
176
+
this preset is used when `NODE_ENV` is set to `development` and overwrites the all preset.
177
+
178
+
```js
179
+
{
180
+
sourcemap:true,
181
+
sourcesContent:true,
182
+
dropLabels: ['__dev_mode__'],
183
+
}
184
+
```
185
+
186
+
you can also add `nano-build-development` field to your `package.json` for overwriting configuration.
187
+
145
188
## Configuration
146
189
147
190
Add 'nano-build' field to your `package.json` for overwriting configuration:
0 commit comments