electron-userland / electron-userland/electron-webpack

webpack code splitting error

Open
#138 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
902
Forks
168
PR merge metrics
No merged PRs in 30d

Description

I'm sure this code is generated by webpack for the electron main target

This is the code at the very top of the bundle, and my app throws an error right away on line 34

```javascript
(module.exports = (function(t) {
var e = {},
n = { 1: 0 }
function r(n) {
if (e[n]) return e[n].exports
var i = (e[n] = { i: n, l: !1, exports: {} })
return t[n].call(i.exports, i, i.exports, r), (i.l = !0), i.exports
}
return (
(r.e = function(e) {
var r = [],
i = n[e]
if (0 !== i)
if (i) r.push(i[2])
else {
var o = new Promise(function(r, o) {
i = n[e] = [r, o]
var a = __dirname + '/' + ({}[e] || e) + '.bundle.js'
require('fs').readFile(a, 'utf-8', function(e, r) {
if (e) return o(e)
var i = {}
require('vm').runInThisContext(
'(function(exports, require, __dirname, __filename) {' + r + '\n})',
a
)(i, require, require('path').dirname(a), a)
var s = i.modules,
u = i.ids /** THIS BLOWS UP. IT IS UNDEFINED for any of the code splitting chunks **/
for (var c in s) t[c] = s[c]
for (var l = [], f = 0; f < u.length; f++)
n[u[f]] && (l = l.concat(n[u[f]][0])), (n[u[f]] = 0)
for (f = 0; f < l.length; f++) l[f]()
})
})
r.push((i[2] = o))
}
return Promise.all(r)
})
```

this part specifically

```javascript
require('vm').runInThisContext(
'(function(exports, require, __dirname, __filename) {' + r + '\n})',
a
)(i, require, require('path').dirname(a), a)
var s = i.modules,
u = i.ids

```

i.ids is undefined.

if I hand edit this i can avoid seeing the error and my app functions normally.

how can i have any influence over this behavior in my code?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.