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

Electron Builder does not include dependencies prefixed with "node:" #2000

Open
trek-eric opened this issue Jul 4, 2024 · 1 comment
Open

Comments

@trek-eric
Copy link

trek-eric commented Jul 4, 2024

Describe the bug
These dependencies were not found:

  • node:http in ./node_modules/@azure/core-rest-pipeline/dist/commonjs/nodeHttpClient.js
  • node:https in ./node_modules/@azure/core-rest-pipeline/dist/commonjs/nodeHttpClient.js
  • node:os in ./node_modules/@azure/core-rest-pipeline/dist/commonjs/util/userAgentPlatform.js, ./node_modules/@azure/logger/dist/commonjs/log.js
  • node:process in ./node_modules/@azure/core-rest-pipeline/dist/commonjs/util/userAgentPlatform.js, ./node_modules/@azure/logger/dist/commonjs/log.js
  • node:stream in ./node_modules/@azure/core-rest-pipeline/dist/commonjs/nodeHttpClient.js, ./node_modules/@azure/core-rest-pipeline/dist/commonjs/util/concat.js
  • node:util in ./node_modules/@azure/core-rest-pipeline/dist/commonjs/util/inspect.js, ./node_modules/@azure/logger/dist/commonjs/log.js
  • node:zlib in ./node_modules/@azure/core-rest-pipeline/dist/commonjs/nodeHttpClient.js

To install them, you can run: npm install --save node:http node:https node:os node:process node:stream node:util node:zlib
ERROR Build failed with errors.

To Reproduce
update a working vue app from 16 to 18 that includes a dependency prefixed with "node:" - Azure's appinsights is a great example

nvm use 16
vue create app
cd app
vue add electron-builder
npm run electron:serve (works!)
nvm use 18
npm update --save
npm install --save applicationinsights
add to background.js :

let appInsights = require("applicationinsights");
console.log(appInsights)

Expected behavior
My understanding is prefixed modules with node:modulename should work fine - i am expecting the builder to build and include the dependencies as it did with node v.16

Environment (please complete the following information):
eg: https://github.com/trek-eric/vue_app_18 - note the commits to see the working vs breaking change

@trek-eric
Copy link
Author

i think i found my own solution - adding the offender to externals:

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  pluginOptions: {
    electronBuilder: {
      nodeIntegration: true,
      // List native deps here if they don't work
      externals: ['applicationinsights'],
      // If you are using Yarn Workspaces, you may have multiple node_modules folders
      // List them all here so that VCP Electron Builder can find them
      nodeModulesPath: ['../../node_modules', './node_modules'],
    }
  }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant