Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing runtime dependencies #1700

Closed
Vector-Green opened this issue May 6, 2023 · 4 comments
Closed

Removing runtime dependencies #1700

Vector-Green opened this issue May 6, 2023 · 4 comments

Comments

@Vector-Green
Copy link

Summary

Hi, I'm making embedded project and all script should be bundled into a single file + some .node files (including node_modules bundling)
currently errors are in https://github.com/mapbox+node-pre-gyp@1.0.10 for example

ERROR in ./node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/lib/Find-VisualStudio.cs 9:6
Module parse failed: Unexpected token (9:6)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| // This script needs to be compatible with PowerShell v2 to run on Windows 2008R2 and

using System;

Can't resolve 'nock'
Can't resolve 'aws-sdk'
Can't resolve 'mock-aws-s3'
Can't resolve 'bluebird'
Can't resolve 'npm'

ERROR in ./node_modules/.pnpm/https://github.com/mapbox+node-pre-gyp@1.0.10/node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

<!doctype html>

after installing pnpm i npm bluebird mock-aws-s3 aws-sdk nock --save-optional
permanent error occures like
./node_modules/.pnpm/npm@9.6.6/node_modules/npm/node_modules/qrcode-terminal/lib/main.js
1 | var QRCode = require('./../vendor/QRCode'),
2 | QRErrorCorrectLevel = require('./../vendor/QRCode/QRErrorCorrectLevel'),

3 | black = "\033[40m \033[0m",

and many others...
In general I cannot bundle sqlite properly including node_modules
is there any ways?
Can I use compiled .node files for an sqlite?

repo https://github.com/Vector-Green/sqlite-node_modules_bundling

Proposed implementation

if there wouldn't be any runtime dependencies that would be possible to bundle all sqlite and it's node_modules into a single file

@Vector-Green
Copy link
Author

Vector-Green commented May 6, 2023

currently the only way I've found is using something like https://www.npmjs.com/package/sqlite3-loader

 /*temporary hack for node-pre-gyp sqlite only*/
          {
            test: /sqlite3-binding\.js$/,
            use: ['sqlite3-loader'],
          },

is there any other ways?)

@Vector-Green
Copy link
Author

by the way, maybe there is any way to include my own .node file)?

@Vector-Green
Copy link
Author

Well, still bad solution, cause that's not possible to build on Windows and run on Linux(

@fcanela
Copy link

fcanela commented Oct 7, 2023

I have created the issue #1721 and I'll be providing more info here for users that may find this in google/etc.

The issue is in node-pre-gyp, which tries to require files that are not declared as a hard dependency but a dev one. There is an issue created with a lot of activity and frustration but as node-pre-gyp is no longer maintained this is not going to be fixed there.

I hope we have info soon about how node-sqlite3 plans to get around this issue.

daniellockyer added a commit that referenced this issue Dec 24, 2023
…stall`

fixes #1641
fixes #1721
fixes #1714
fixes #1713
fixes #1700
fixes #1704

- `@mapbox/node-pre-gyp` is effectively unmaintained [1] as has a few bugs
  which our users keep running into
- it seems the prebuilt binary world has moved in favor of prebuild +
  it's various other forms
- one option would be to use prebuildify to bundle all binaries into the
  package, but that's a step too far removed from the current situation
  for now
- instead, we can use prebuild-install to download the binaries, and
  `prebuild` to build + upload the binaries
- this means we can remove node-pre-gyp and fix a bunch of issues!

[1]: mapbox/node-pre-gyp#657
daniellockyer added a commit that referenced this issue Dec 24, 2023
…stall`

fixes #1641
fixes #1721
fixes #1714
fixes #1713
fixes #1700
fixes #1704

- `@mapbox/node-pre-gyp` is effectively unmaintained [1] as has a few bugs
  which our users keep running into
- it seems the prebuilt binary world has moved in favor of prebuild +
  it's various other forms
- one option would be to use prebuildify to bundle all binaries into the
  package, but that's a step too far removed from the current situation
  for now
- instead, we can use prebuild-install to download the binaries, and
  `prebuild` to build + upload the binaries
- this means we can remove node-pre-gyp and fix a bunch of issues!
- eventually, we could start providing electron prebuilt binaries too

[1]: mapbox/node-pre-gyp#657
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants