babel-loader: babel-loader 8.0.0 fails, but 8.0.0-beta.4 works perfectly

BEFORE YOU SUBMIT please read the following:

Delete what isn’t applicable below I’m submitting a bug report I’m submitting a feature request I’m submitting a support request => Please do not submit support request here, see note at the top of this template.

Webpack Version: 4.17.1

Babel Core Version: 7.0.0

Babel Loader Version: 8.0.0

Please tell us about your environment: Windows 7 x64

Current behavior: Here’s just a small sample of the very long list of console messages. First message - error:

storage.js:26 Uncaught ReferenceError: exports is not defined
    at Module.<anonymous> (storage.js:26)
    at Module../app/utils/electron/storage.js (renderer.dev.js:34068)
    at __webpack_require__ (bootstrap:724)
    at fn (bootstrap:101)
    at Module../app/utils/electron/index.js (renderer.dev.js:33851)
    at __webpack_require__ (bootstrap:724)
    at fn (bootstrap:101)
    at Module.<anonymous> (renderer.dev.js:22555)
    at Module../app/index.js (renderer.dev.js:22738)
    at __webpack_require__ (bootstrap:724)

followed by these warnings:

(anonymous) @ storage.js:26
./app/utils/electron/storage.js @ renderer.dev.js:34068
__webpack_require__ @ bootstrap:724
fn @ bootstrap:101
./app/utils/electron/index.js @ renderer.dev.js:33851
__webpack_require__ @ bootstrap:724
fn @ bootstrap:101
(anonymous) @ renderer.dev.js:22555
./app/index.js @ renderer.dev.js:22738
__webpack_require__ @ bootstrap:724
fn @ bootstrap:101
0 @ log.js:47
__webpack_require__ @ bootstrap:724
(anonymous) @ bootstrap:791
(anonymous) @ bootstrap:791
sockjs.js:1605 XHR finished loading: GET "http://localhost:1212/sockjs-node/info?t=1535560470291".
AbstractXHRObject._start @ sockjs.js:1605
(anonymous) @ sockjs.js:1494
setTimeout (async)
AbstractXHRObject @ sockjs.js:1493
XHRCorsObject @ sockjs.js:2871
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:730
initSocket @ socket.js:9
(anonymous) @ client?5bf0:212
./node_modules/webpack-dev-server/client/index.js?http://localhost:1212 @ renderer.dev.js:50057
__webpack_require__ @ bootstrap:724
fn @ bootstrap:101
0 @ log.js:47
__webpack_require__ @ bootstrap:724
(anonymous) @ bootstrap:791
(anonymous) @ bootstrap:791
sockjs.js:1605 XHR finished loading: GET "http://localhost:1212/sockjs-node/info?t=1535560470293".
AbstractXHRObject._start @ sockjs.js:1605
(anonymous) @ sockjs.js:1494
setTimeout (async)
AbstractXHRObject @ sockjs.js:1493
XHRCorsObject @ sockjs.js:2871
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:730
initSocket @ socket.js:9
(anonymous) @ client?8f77:212
./node_modules/webpack-dev-server/client/index.js?http://localhost:1212/ @ renderer.dev.js:50317
__webpack_require__ @ bootstrap:724
fn @ bootstrap:101
0 @ log.js:47
__webpack_require__ @ bootstrap:724
(anonymous) @ bootstrap:791
(anonymous) @ bootstrap:791
client?5bf0:77 [WDS] Hot Module Replacement enabled.
client?5bf0:148 [WDS] Warnings while compiling.
warnings @ client?5bf0:148
onmessage @ socket.js:41
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:887
SockJS._transportMessage @ sockjs.js:885
EventEmitter.emit @ sockjs.js:86
WebSocketTransport.ws.onmessage @ sockjs.js:2961
client?5bf0:154 ./app/redux/actions/helpScreen_actions.js 19:10-35

the list of warnings was very long. This is far from all of them.

Expected/desired behavior: No errors - as in 8.0.0-beta.4

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@Slapbox it seems u don’t solve this problem yet……i occur this problem too, and i use Webpack Version: 4.26.1

Babel Core Version: 7.0.0

Babel Loader Version: 8.0.4 babel-loader^8.0.0 doesn’t work neither…… seems like babel can’t transpiled export default, well, it’s babel-loader^8.0.0+ can’t do it actually……(may be) until u said babel-loader^8.0.0-beta.4 works perfectly, i tried install babel-loader^8.0.0-beta.4 instead babel-loader^8.0.0: Webpack Version: 4.26.1

Babel Core Version: 7.0.0

Babel Loader Version: 8.0.0-beta.4 it worked!!! i don’t know why, but it worked thx ; )

You can always opt into the old behavior by setting modules: “commonjs” in your preset-env options to get the old behavior for now.

Generally mixing module types is a bad idea. Mocking depends a bit on what test framework you’re using, but for instance Jest as jest.mock.

Fair enough! It definitely seems like a mismatch of module types somewhere from something, but it’s hard to say exactly.