<ul dir="auto">
<li>Output of <code class="notranslate">node_modules/.bin/electron --version</code>: v4.0.2 x86</li>
<li>Operating System (Platform and Version): win7 sp1 x64</li>
</ul>
<p dir="auto"><strong>Expected Behavior</strong><br>
no duplication</p>
<p dir="auto"><strong>Actual behavior</strong><br>
each console.log from the preload script produces 2 renderer devtools console entries</p>
<p dir="auto"><strong>To Reproduce</strong></p>
<ul dir="auto">
<li>run the following app</li>
<li>in the renderer devtools settings (Console)
<ul dir="auto">
<li>uncheck "group similar"</li>
<li>check "preserve log"</li>
<li>check "show timestamps"</li>
</ul>
</li>
<li>navigate via devtools console (<code class="notranslate">location = 'about:blank'</code>)<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/895588/51873190-3073ba00-232a-11e9-8c0d-24f75f5ab79e.png"><img src="https://user-images.githubusercontent.com/895588/51873190-3073ba00-232a-11e9-8c0d-24f75f5ab79e.png" alt="image" style="max-width: 100%;"></a></li>
</ul>
<h5 dir="auto">app.js</h5>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="'use strict';

const {app, BrowserWindow} = require('electron'),
      Path = require('path');

let win;

app.on('ready', async () =&gt; {

  win = new BrowserWindow({
    width: 1440,
    height: 900,
    useContentSize: true,
    webPreferences: {
      preload: Path.join(__dirname, 'preload.js'),
    },
  });

  win.webContents.debugger.attach();

  win.webContents.openDevTools({mode: 'right'});

  win.loadURL('about:blank');

});"><pre class="notranslate"><span class="pl-s">'use strict'</span><span class="pl-kos">;</span>

<span class="pl-k">const</span> <span class="pl-kos">{</span>app<span class="pl-kos">,</span> BrowserWindow<span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'electron'</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
      <span class="pl-v">Path</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'path'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">let</span> <span class="pl-s1">win</span><span class="pl-kos">;</span>

<span class="pl-s1">app</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'ready'</span><span class="pl-kos">,</span> <span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>

  <span class="pl-s1">win</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-v">BrowserWindow</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
    <span class="pl-c1">width</span>: <span class="pl-c1">1440</span><span class="pl-kos">,</span>
    <span class="pl-c1">height</span>: <span class="pl-c1">900</span><span class="pl-kos">,</span>
    <span class="pl-c1">useContentSize</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">webPreferences</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">preload</span>: <span class="pl-v">Path</span><span class="pl-kos">.</span><span class="pl-en">join</span><span class="pl-kos">(</span><span class="pl-s1">__dirname</span><span class="pl-kos">,</span> <span class="pl-s">'preload.js'</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-s1">win</span><span class="pl-kos">.</span><span class="pl-c1">webContents</span><span class="pl-kos">.</span><span class="pl-c1">debugger</span><span class="pl-kos">.</span><span class="pl-en">attach</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-s1">win</span><span class="pl-kos">.</span><span class="pl-c1">webContents</span><span class="pl-kos">.</span><span class="pl-en">openDevTools</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">mode</span>: <span class="pl-s">'right'</span><span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-s1">win</span><span class="pl-kos">.</span><span class="pl-en">loadURL</span><span class="pl-kos">(</span><span class="pl-s">'about:blank'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h5 dir="auto">preload.js</h5>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="console.log('preload log 1');
console.log('preload log 2');"><pre class="notranslate"><span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'preload log 1'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'preload log 2'</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">For projects using Atom Shell that are not Atom, using the "Atom Package Manager" to build native modules is a bit strange. It might be useful to have a core component of Atom Shell be a tool to build native modules that is not so deeply connected to the Atom project to make packaging easier for other framework users, perhaps allowing for building a dist of atom-shell (e.g. from a branch) and rebuilding specified modules to match it in one go. I'm curious to hear thoughts on this from @atom/core as well as other people trying to build on this framework.</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/paulcbetts/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/paulcbetts">@paulcbetts</a> who brought this up in conversation yesterday</p>