Git Product home page Git Product logo

Comments (15)

nashaofu avatar nashaofu commented on June 2, 2024

请确保是修改的webpack打包主进程的配置,你有可能是修改的渲染进程的代码

from screenshots.

MrZhangbing avatar MrZhangbing commented on June 2, 2024

请确保是修改的webpack打包主进程的配置,你有可能是修改的渲染进程的代码
vue.config.js
chainWebpack: (config) => {
Object.assign(config,{
externals: {
'shortcut-capture': "shortcut-capture"
}
})
},
configureWebpack: {
externals: {
'shortcut-capture': "shortcut-capture"
}
},
const shortcutCapture = new ShortcutCapture({ isUseClipboard: true})
打印 shortcutCapture,shortcutCapture.shortcutCapture

得到
shortcutCapture: c {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
'$win': null
}
shortcutCapture.shortcutCapture: [Function: shortcutCapture]
这个方法是有的啊

from screenshots.

MrZhangbing avatar MrZhangbing commented on June 2, 2024

我的是mac端。

from screenshots.

nashaofu avatar nashaofu commented on June 2, 2024

这个方法是一定有的,但是由于截图插件要加载html页面,所以是html页面加载失败了,你可以在主进程中使用require.resolve去加载一下插件,看看路径是不是位于node_mudules下的

from screenshots.

nashaofu avatar nashaofu commented on June 2, 2024

https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/configuration.html#webpack-configuration
image
image

from screenshots.

MrZhangbing avatar MrZhangbing commented on June 2, 2024

我在electron-vue中,能正常使用,但是在Vue CLI Plugin Electron Builder
这个我有在主进程中试过,而且多种都尝试过;还是没起作用。
代码如:
pluginOptions: {
electronBuilder: {
chainWebpackMainProcess: config => {
Object.assign(config, {
externals: ['shortcut-capture']})
return config
},
}
},

pluginOptions: {
	electronBuilder: {
		chainWebpackMainProcess: config => {
			Object.assign(config,	{
				externals: {
					'shortcut-capture':"require('shortcut-capture')"
				}
			})
			return config
		},
	}
},

pluginOptions: {
	electronBuilder: {
		chainWebpackMainProcess: config => {
			return{
				externals: {
					'shortcut-capture':"require('shortcut-capture')"
				}
			}
		},
	}
},

from screenshots.

MrZhangbing avatar MrZhangbing commented on June 2, 2024

https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/configuration.html#webpack-configuration
image
image
上面都尝试了,还是不行

from screenshots.

nashaofu avatar nashaofu commented on June 2, 2024

你注意看一下文档,请使用链式调用去修改webpack配置

from screenshots.

MrZhangbing avatar MrZhangbing commented on June 2, 2024

你注意看一下文档,请使用链式调用去修改webpack配置

这个配置不一定要链式,但是用链式的也是同样的情况,无法使用。

from screenshots.

MrZhangbing avatar MrZhangbing commented on June 2, 2024

image
config.externals({'shortcut-capture':"require('shortcut-capture')"})

from screenshots.

nashaofu avatar nashaofu commented on June 2, 2024

问题解决了吗?我这里使用vue-cli-plugin-electron-builder配置了一个,没有问题,仓库:https://github.com/nashaofu/vue-cli-plugin-electron-builder-issue

from screenshots.

MrZhangbing avatar MrZhangbing commented on June 2, 2024

问题解决了吗?我这里使用vue-cli-plugin-electron-builder配置了一个,没有问题,仓库:https://github.com/nashaofu/vue-cli-plugin-electron-builder-issue

在windows端 下载下来是有效的,mac端还是无效。 但是在electron-vue项目中,mac端是有效的。

from screenshots.

nashaofu avatar nashaofu commented on June 2, 2024

from screenshots.

MrZhangbing avatar MrZhangbing commented on June 2, 2024

我就是在mac上测试可用的 在 2019年8月29日,10:39,MrZhangbing <[email protected]mailto:[email protected]> 写道: 问题解决了吗?我这里使用vue-cli-plugin-electron-builder配置了一个,没有问题,仓库:https://github.com/nashaofu/vue-cli-plugin-electron-builder-issue 在windows端 下载下来是有效的,mac端还是无效。 但是在electron-vue项目中,mac端是有效的。 — You are receiving this because you commented. Reply to this email directly, view it on GitHub<#18?email_source=notifications&email_token=AETIVES4Z7BE6O4TNCYWCFDQG4ZGLA5CNFSM4IO3HNCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5NBH7Q#issuecomment-525997054>, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AETIVEQTHAWBVIEOGSA5JI3QG4ZGLANCNFSM4IO3HNCA.

我试了下,别人的mac也是可以的 ,我的mac怎么试都不行。

from screenshots.

simo-an avatar simo-an commented on June 2, 2024
        const externals = {
          'shortcut-capture' : 'require("shortcut-capture")',
        };

        config.externals(externals);

Above Config would be useless when you execute electron:build to pack app

I slove this problem by config like this

    electronBuilder : {
      externals               : [ 'shortcut-capture' ],
      // ....
   }

it runs fine

from screenshots.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.