👋 hi everyone, when we try to dynamically import some icons using webpack 3+4 dynamic import syntax we get this error in CI for happo:
Error: Could not load script: "http://localhost/92.happo-bundle-react-L3Jvb3Qvc3R1ZGlv.js"
at onErrorWrapped (/root/studio/node_modules/jsdom/lib/jsdom/browser/resources/per-document-resource-loader.js:39:19)
at Object.check (/root/studio/node_modules/jsdom/lib/jsdom/browser/resources/resource-queue.js:58:23)
at request.then.catch.err (/root/studio/node_modules/jsdom/lib/jsdom/browser/resources/resource-queue.js:104:14)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7) { RequestError: Error: connect ECONNREFUSED 127.0.0.1:80
at new RequestError (/root/studio/node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/root/studio/node_modules/request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback [as _callback] (/root/studio/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/root/studio/node_modules/request/request.js:185:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (/root/studio/node_modules/request/request.js:881:8)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at Socket.socketErrorListener (_http_client.js:387:9)
name: 'RequestError',
message: 'Error: connect ECONNREFUSED 127.0.0.1:80',
cause:
{ Error: connect ECONNREFUSED 127.0.0.1:80
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 80 },
error:
{ Error: connect ECONNREFUSED 127.0.0.1:80
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 80 },
options:
{ encoding: null,
gzip: true,
jar: RequestJar { _jar: [Object] },
strictSSL: true,
forever: true,
headers:
{ 'User-Agent': 'Mozilla/5.0 (linux) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/12.0.0',
'Accept-Language': 'en',
Accept: '*/*',
referer: 'http://localhost/' },
uri: 'http://localhost/92.happo-bundle-react-L3Jvb3Qvc3R1ZGlv.js',
callback: [Function: RP$callback],
transform: undefined,
simple: true,
resolveWithFullResponse: false,
transform2xxOnly: false },
response: undefined }
Error: Loading chunk 92 failed.
at HTMLScriptElement.onScriptComplete (file:///tmp/happo-bundle-react-L3Jvb3Qvc3R1ZGlv.js:99:24)
at HTMLScriptElement.el.addEventListener.event (/root/studio/node_modules/jsdom/lib/jsdom/living/helpers/create-event-accessor.js:33:32)
at invokeEventListeners (/root/studio/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
at HTMLScriptElementImpl._dispatch (/root/studio/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
at HTMLScriptElementImpl.dispatchEvent (/root/studio/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
at HTMLScriptElementImpl.dispatchEvent (/root/studio/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
at onErrorWrapped (/root/studio/node_modules/jsdom/lib/jsdom/browser/resources/per-document-resource-loader.js:37:15)
at Object.check (/root/studio/node_modules/jsdom/lib/jsdom/browser/resources/resource-queue.js:58:23)
at request.then.catch.err (/root/studio/node_modules/jsdom/lib/jsdom/browser/resources/resource-queue.js:104:14)
at <anonymous>
customizeWebpackConfig: config => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
use: [
{
loader: 'ts-loader',
},
],
})
config.resolve = Object.assign({}, config.resolve, {
extensions: ['.tsx', '.ts', '.js'],
}) // add in the existing config.resolve that happo needs
return config
},