LivelyKernel / lively4-core

A Self-supporting, Web-based Development Environment
https://lively-kernel.org/lively4/lively4-core/start.html
MIT License
77 stars 25 forks source link

Uncaught (in promise) Error: require is not defined #17

Closed daniel-wer closed 8 years ago

daniel-wer commented 8 years ago

This commit (b57e0a658198e5e38c92fd0604e810cbd3064df3) introduced a rergression for some of us. It is causing the following error message and the site becomes unusable:

Uncaught (in promise) Error: require is not defined
    Error loading http://localhost:8000/lively4-core/src/client/morphic/component-loader.js
    at execute (http://localhost:8000/lively4-core/src/client/script-manager.js!transpiled:177:25)
    at ensureEvaluated (https://livelykernel.github.io/lively4-core/src/external/system.src.js:2112:26)
    at ensureEvaluated (https://livelykernel.github.io/lively4-core/src/external/system.src.js:2104:11)
    at Object.execute (https://livelykernel.github.io/lively4-core/src/external/system.src.js:2248:13)
    at doDynamicExecute (https://livelykernel.github.io/lively4-core/src/external/system.src.js:715:25)
    at link (https://livelykernel.github.io/lively4-core/src/external/system.src.js:916:20)
    at doLink (https://livelykernel.github.io/lively4-core/src/external/system.src.js:569:7)
    at updateLinkSetOnLoad (https://livelykernel.github.io/lively4-core/src/external/system.src.js:617:18)
    at https://livelykernel.github.io/lively4-core/src/external/system.src.js:430:11

Seems to be a race-condition, where require is not loaded in time, as it is not happening for everybody, and there are sometimes 2, sometimes 4 errors...

Reverting it for one specific html-file fixes the issue.

numberpi commented 8 years ago

Reverting it for one specific html-file did not fix the issue for me. I get different errors like:

Failed to load resource: the server responded with a status of 404 (Not Found) Uncaught [object DOMException] GET http://localhost:8080/serviceworker-loader.js net::ERR_FILE_EXISTS

daniel-wer commented 8 years ago

Yes, I get that one as well, but at least the site seems to work for me that way.

Lixissimus commented 8 years ago

When I revert it in an html file, where I have a lively-component-bin, I get the following:

Uncaught ReferenceError: babel is not defined
functionFromString @ script-manager.js:21
findLively4Script @ script-manager.js:42
attachScriptsFromShadowDOM @ script-manager.js:62
proto.createdCallback @ component-loader.js:32
register @ component-loader.js:39
(anonymous function) @ lively-component-bin.html:66
onsetsu commented 8 years ago

@Lixissimus: The current version of src/client/system-babel.html imports babel globally via a script tag. Reverting it to the following

<script src="https://livelykernel.github.io/lively4-core/src/external/system.src.js" type="text/javascript" charset="utf-8"></script>
<script>
  System.paths['babel'] ='https://livelykernel.github.io/lively4-core/src/external/babel-browser.js'
  System.config({
    transpiler: 'babel',
    babelOptions: { },
    map: {
        babel: 'https://livelykernel.github.io/lively4-core/src/external/babel-browser.js'
    }
  });
</script>

will cause babel/browser.js to be loaded as a module, thus babel will not be available as a global.

You could try to mitigate this issue by including babel via script tag (like it is currently done in src/client/system-babel.html).

onsetsu commented 8 years ago

Unfortunately, I am unable to reproduce the original proposed error.

@daniel-wer: Can you further specify your settings?

JensLincke commented 8 years ago

seems not to be a problem any longer