Can't Inject Javascript into Nativefier Slack App #1200
Comments
My guess would be this being the problem:
Pulling up Slack in my browser, I get the same error when trying to do something like Let us know if that ends up being the true issue. |
Removing jQuery will be a lot of extra work. And I included jquery in min layout.js file. The problem is that jquery is not initiating, any thoughts on that? I've tried to include jquery in a separeted file also, and did not work as well, same isse jquery was not recognized. |
We'll try to take a look at why the jQuery doesn't get injected as a file. In the meantime, it looks like you can use the |
I'll look in to it and send the result here |
I tried to remove jquery and it worked, the problem is with the jquery script |
In that case, is this solved now then? |
i really want to inject jquery =( can you point me a away so I can correct the problem? |
Ah, I misunderstood you when you said "it worked". I'll look into it when I can. |
I'm trying to inject jquery and custom js into my slack app, but neither of them are injected. I also tried to put everything in one js file . Here is my code:
Steps to reproduce
nativefier "https://app.slack.com" --inject layout.js --inject layout.css --name "Slack" --verbose
VERBOSE
Running in verbose mode! This will produce a mountain of logs and is recommended only for troubleshooting or if you like Shakespeare.
Performing async options post-processing.
Inferring user agent for electron 12.0.7 / darwin
Grabbing electron<->chrome versions file from https://atom.io/download/atom-shell/index.json
Inferring icon for https://app.slack.com/client/TM8MU2955 on darwin
Inferring icon from store for https://app.slack.com/client/TM8MU2955 on darwin
Allowed icon formats when building for darwin: [ '.icns' ]
Got name Slack from options. No inferring needed
Sanitized filename for Slack : Slack
Got 249 icons from gitcloud
Max icon match score: 1
Downloading https://nativefier.github.io/nativefier-icons/files/slack.icns
Got an icon from the page.
Writing 208.0 kb icon to /tmp/nativefier-9-34-5-iconinfer--28937-xVOLK8tNQPfv/icon.icns
Associated electron v12.0.7 to chrome v89.0.4389.128
Given chrome 89.0.4389.128 on darwin, using user agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36
options {
packager: {
appCopyright: undefined,
appVersion: undefined,
arch: 'x64',
asar: false,
buildVersion: undefined,
darwinDarkModeSupport: false,
dir: '/usr/local/lib/node_modules/nativefier/app',
electronVersion: '12.0.7',
icon: '/tmp/nativefier-9-34-5-iconinfer--28937-xVOLK8tNQPfv/icon.icns',
name: 'Slack',
out: '/Users/brunocavenaghi/Desktop/slack-app',
overwrite: true,
platform: 'darwin',
portable: false,
targetUrl: 'https://app.slack.com/client/TM8MU2955',
tmpdir: false,
upgrade: false,
upgradeFrom: undefined,
win32metadata: {
ProductName: 'Slack',
InternalName: 'Slack',
FileDescription: 'Slack'
}
},
nativefier: {
accessibilityPrompt: true,
alwaysOnTop: false,
backgroundColor: null,
basicAuthPassword: null,
basicAuthUsername: null,
blockExternalUrls: false,
bookmarksMenu: null,
bounce: false,
browserwindowOptions: undefined,
clearCache: false,
counter: false,
crashReporter: undefined,
disableContextMenu: undefined,
disableDevTools: undefined,
disableGpu: false,
diskCacheSize: null,
disableOldBuildWarning: false,
enableEs3Apis: false,
fastQuit: false,
fileDownloadOptions: undefined,
flashPluginDir: null,
fullScreen: false,
globalShortcuts: null,
hideWindowFrame: undefined,
ignoreCertificate: false,
ignoreGpuBlacklist: false,
inject: [ 'layout.js', 'layout.css' ],
insecure: false,
internalUrls: null,
lang: undefined,
maximize: false,
nativefierVersion: '43.1.3',
processEnvs: undefined,
proxyRules: null,
showMenuBar: false,
singleInstance: false,
titleBarStyle: null,
tray: false,
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36',
userAgentOverriden: false,
verbose: true,
versionString: undefined,
width: 1280,
height: 800,
minWidth: undefined,
minHeight: undefined,
maxWidth: undefined,
maxHeight: undefined,
widevine: false,
x: undefined,
y: undefined,
zoom: 1
}
}
Preparing Electron app...
Copying electron app from /usr/local/lib/node_modules/nativefier/app to /tmp/nativefier-9-34-5-app--28937-aLCULubse5Ah
Writing app config to /tmp/nativefier-9-34-5-app--28937-aLCULubse5Ah/nativefier.json
Copying 2 files to inject in app.
Copying injection file "layout.js" to "/tmp/nativefier-9-34-5-app--28937-aLCULubse5Ah/inject/inject-0c1ddb.js"
Copying injection file "layout.css" to "/tmp/nativefier-9-34-5-app--28937-aLCULubse5Ah/inject/inject-577883.css"
Updating /tmp/nativefier-9-34-5-app--28937-aLCULubse5Ah/package.json 'name' field to slack-nativefier-397e15
Converting icons...
Building for macOS and icon is already a .icns, no conversion needed
Copying icons if necessary
No copying necessary on macOS; aborting
Packaging... This will take a few seconds, maybe minutes if the requested Electron isn't cached yet...
electron-packager Electron Packager 15.2.0
electron-packager Node v16.2.0
electron-packager Host Operating system: darwin 20.3.0 (x64) +0ms
electron-packager Packager Options: {"arch":"x64","asar":false,"darwinDarkModeSupport":false,"dir":"/tmp/nativefier-9-34-5-app--28937-aLCULubse5Ah","electronVersion":"12.0.7","icon":"/tmp/nativefier-9-34-5-iconinfer--28937-xVOLK8tNQPfv/icon.icns","name":"Slack","out":"/Users/brunocavenaghi/Desktop/slack-app","overwrite":true,"platform":"darwin","portable":false,"targetUrl":"https://app.slack.com/client/TM8MU2955","tmpdir":false,"upgrade":false,"win32metadata":{"ProductName":"Slack","InternalName":"Slack","FileDescription":"Slack"}} +0ms
electron-packager Target Platforms: darwin +0ms
electron-packager Target Architectures: x64 +0ms
electron-packager Inferring appVersion from version in /tmp/nativefier-9-34-5-app--28937-aLCULubse5Ah/package.json +0ms
electron-packager Application name: Slack +5ms
electron-packager Target Electron version: 12.0.7 +0ms
electron-packager Ignored path regular expressions: [
'/package-lock\.json$',
'/yarn\.lock$',
'/\.git($|/)',
'/node_modules/\.bin($|/)',
'\.o(bj)?$'
] +0ms
electron-packager Downloading Electron with options {"platform":"darwin","arch":"x64","version":"12.0.7","artifactName":"electron"} +0ms
Packaging app for platform darwin x64 using electron v12.0.7
electron-packager Creating /Users/brunocavenaghi/Desktop/slack-app/darwin-x64-template +2ms
electron-packager Extracting /Users/brunocavenaghi/Library/Caches/electron/4f029753a9a8576806dced687079cdf26638acb9ef0f41141be4eff390c1bd52/electron-v12.0.7-darwin-x64.zip to /Users/brunocavenaghi/Desktop/slack-app/darwin-x64-template +1ms
electron-packager Initializing app in /Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-x64 from /Users/brunocavenaghi/Desktop/slack-app/darwin-x64-template template +0ms
electron-packager Ignored paths based on the out param: [
'/Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-x64',
'/Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-arm64',
'/Users/brunocavenaghi/Desktop/slack-app/Slack-linux-ia32',
'/Users/brunocavenaghi/Desktop/slack-app/Slack-linux-x64',
'/Users/brunocavenaghi/Desktop/slack-app/Slack-linux-armv7l',
'/Users/brunocavenaghi/Desktop/slack-app/Slack-linux-arm64',
'/Users/brunocavenaghi/Desktop/slack-app/Slack-linux-mips64el',
'/Users/brunocavenaghi/Desktop/slack-app/Slack-mas-x64',
'/Users/brunocavenaghi/Desktop/slack-app/Slack-mas-arm64',
'/Users/brunocavenaghi/Desktop/slack-app/Slack-win32-ia32',
'/Users/brunocavenaghi/Desktop/slack-app/Slack-win32-x64',
'/Users/brunocavenaghi/Desktop/slack-app/Slack-win32-arm64'
] +2s
electron-packager Copying icon "/tmp/nativefier-9-34-5-iconinfer--28937-xVOLK8tNQPfv/icon.icns" to app's Resources as "electron.icns" +0ms
electron-packager Renaming Electron to Slack in /Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-x64/Electron.app/Contents/MacOS +54ms
electron-packager Renaming Electron Helper to Slack Helper in /Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-x64/Electron.app/Contents/Frameworks/Electron Helper.app/Contents/MacOS +1ms
electron-packager Renaming Electron Helper (Renderer) to Slack Helper (Renderer) in /Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-x64/Electron.app/Contents/Frameworks/Electron Helper (Renderer).app/Contents/MacOS +0ms
electron-packager Renaming Electron Helper (Plugin) to Slack Helper (Plugin) in /Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-x64/Electron.app/Contents/Frameworks/Electron Helper (Plugin).app/Contents/MacOS +1ms
electron-packager Renaming Electron Helper (GPU) to Slack Helper (GPU) in /Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-x64/Electron.app/Contents/Frameworks/Electron Helper (GPU).app/Contents/MacOS +0ms
electron-packager Renaming Electron Helper.app to Slack Helper.app in /Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-x64/Electron.app/Contents/Frameworks +0ms
electron-packager Renaming Electron Helper (Renderer).app to Slack Helper (Renderer).app in /Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-x64/Electron.app/Contents/Frameworks +0ms
electron-packager Renaming Electron Helper (Plugin).app to Slack Helper (Plugin).app in /Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-x64/Electron.app/Contents/Frameworks +0ms
electron-packager Renaming Electron Helper (GPU).app to Slack Helper (GPU).app in /Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-x64/Electron.app/Contents/Frameworks +0ms
Finalizing build...
App built to /Users/brunocavenaghi/Desktop/slack-app/Slack-darwin-x64, move to wherever it makes sense for you and run the app bundle.
** CONSOLE ERRORS**
VM76 preload.js:85 Error encoutered injecting JS files ReferenceError: jQuery is not defined
at Object. (VM112 inject-1bc610.js:46)
at Object. (VM112 inject-1bc610.js:47)
at Module._compile (VM43 loader.js:1078)
at Object.Module._extensions..js (VM43 loader.js:1108)
at Module.load (VM43 loader.js:935)
at Module._load (VM43 loader.js:776)
at Function.f._load (VM70 asar_bundle.js:5)
at Function.o._load (VM75 renderer_init.js:33)
at Module.require (VM43 loader.js:959)
at require (VM50 helpers.js:88)
The text was updated successfully, but these errors were encountered: