mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-25 18:37:19 +00:00
Hello,
I have a use case where size of an application is important, I'd like to
webpack as much as possible. The problematic part is related *.node
files, I found a potential solution, example with sqlite:
```
externals: {
'./sqlite3-binding.js': 'commonjs ./node_sqlite3.node',
}
```
I can replace sqlite3-binding.js [1] with *.node, then I copy
node_sqlite3.node to the main application folder. I'd like to try
something similar with the serialport. However, it is slightly more
complicated since serialport doesn't have single import file. This PR is
an attempt to fix the problem.
[1]
https://github.com/TryGhost/node-sqlite3/blob/master/lib/sqlite3-binding.js
---------
Co-authored-by: Krzysztof Rosiński <krzysiek@jrdltd.co.uk>
5 lines
201 B
TypeScript
5 lines
201 B
TypeScript
import { join } from 'path'
|
|
import nodeGypBuild from 'node-gyp-build'
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export const binding = nodeGypBuild(join(__dirname, '../')) as any
|