@tramvai/build 7.1.0 → 7.2.0

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 +6 -19
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -24,9 +24,7 @@ Add necessary fields to `package.json`:
24
24
  "module": "lib/index.es.js",
25
25
  "typings": "lib/index.d.ts",
26
26
  "sideEffects": false,
27
- "files": [
28
- "lib"
29
- ]
27
+ "files": ["lib"]
30
28
  }
31
29
  ```
32
30
 
@@ -53,21 +51,10 @@ Create `tsconfig.json`:
53
51
  "outDir": "./lib",
54
52
  "declarationDir": "./lib",
55
53
  "types": ["node"],
56
- "lib": [
57
- "es2015",
58
- "es2016",
59
- "es2017",
60
- "es2018",
61
- "dom"
62
- ]
54
+ "lib": ["es2015", "es2016", "es2017", "es2018", "dom"]
63
55
  },
64
56
  "include": ["./src"],
65
- "exclude": [
66
- "**/*.spec.ts",
67
- "**/*.spec.tsx",
68
- "**/*.test.ts",
69
- "**/*.test.tsx"
70
- ]
57
+ "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx"]
71
58
  }
72
59
  ```
73
60
 
@@ -119,7 +106,7 @@ When bundling package in the app through `webpack` with option `target: 'node'`
119
106
 
120
107
  Modern bundlers support ES modules and non-standard field `"browser"` in `package.json`. When field `browser` in specified in `package.json`, `@tramvai/build` will generate bundle in `ES2022` standard in `ES modules` format.
121
108
 
122
- If field `browser` in `package.json` is defined as a string then this string determines entry point to `browser` bundle and its name. E.g. when `"browser": "lib/browser.js"` entry point will be `src/browser.ts` and bundle will have a name `lib/browser.js`.
109
+ If field `browser` in `package.json` is defined as a string then this string determines entry point to `browser` bundle and its name. E.g. when `"browser": "lib/browser.js"` entry point will be `src/index.ts` and bundle will have a name `lib/browser.js`.
123
110
 
124
111
  Otherwise, if field `browser` is defined as an object and build was called with flag `--forPublish` then name is defined by the field `main` in `package.json` with adding postfix `.browser` e.g. `lib/index.browser.js`. After that to field `browser` new property will be added as pointer for bundlers to bundle for the browser, instead of the field `module`:
125
112
 
@@ -216,7 +203,7 @@ new TramvaiBuild(options).copy();
216
203
 
217
204
  ### Build separate bundle for browsers
218
205
 
219
- Let's say we have to entry points. One is for the server - `src/server.ts` and for the client - `src/browser.ts`. In this case we should set field `browser` in `package.json` the next way:
206
+ Let's say we have to entry points. One is for the server - `src/server.ts` and for the client - `src/index.ts`. In this case we should set field `browser` in `package.json` the next way:
220
207
 
221
208
  ```json
222
209
  {
@@ -238,7 +225,7 @@ After build for publication we will get next `package.json`:
238
225
 
239
226
  ### Replace specific module for browser bundle
240
227
 
241
- Let's say we have one entry point - `src/index.ts` and a module `src/external.ts` we want to replace by `src/external.browser.ts`. In this case we should set field `browser` in `package.json` the next way:
228
+ Let's say we have one entry point - `src/index.ts` and a module `src/external.ts` we want to replace by `src/external.index.ts`. In this case we should set field `browser` in `package.json` the next way:
242
229
 
243
230
  ```json
244
231
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/build",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "description": "Rollup wrapper, build multiple bundles for different module systems",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {