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: node/DEVELOPER.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -170,3 +170,28 @@ Development on the Node wrapper may involve changes in either the TypeScript or
170
170
- [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) - in-editor test runner.
171
171
- [Jest Test Explorer](https://marketplace.visualstudio.com/items?itemName=kavod-io.vscode-jest-test-adapter) - adapter to the VSCode testing UI.
172
172
- [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) - Rust language support for VSCode.
173
+
174
+
### Hybrid package publishing methode
175
+
176
+
In this project we are using hybrid method for building the package for NODE.
177
+
Hybrid method -
178
+
In order to build the package for usage bothe in mjs and cjs we are using three different tsconfig files.
179
+
tsconfig-base as the general tsconfig file, which the others will inherited from.
180
+
tsconfig-cjs for commonJS build with commonjs as the target of translation and and tsconfig for ECMA build with ECMA as the target of translation.
181
+
182
+
While running build we run two different builds - one will use tsconfig and will translate the package into build-ts/mjs, and the other will use tsconfig-cjs and will translate the package into build-ts/cjs.
183
+
184
+
In our package.json we are adding the rule -
185
+
186
+
```
187
+
"exports": {
188
+
".": {
189
+
"import": "./build-ts/mjs/index.js",
190
+
"require": "./build-ts/cjs/index.js"
191
+
}
192
+
},
193
+
```
194
+
195
+
In which depends on what type of import statement the user choose (import in ECMA, and require in commonJS), the user will get the fitting package to his standard.
196
+
As part of the build we are running the fixup_pj_files_for_build_type script -
197
+
This script add "type" and "types" values to the different package.json that been created for mjs and cjs with the fitting values.
0 commit comments