Skip to content

Commit

Permalink
Merge pull request #1453 from stealjs/no-main2
Browse files Browse the repository at this point in the history
Prevent the "no main loaded" warning with inline scripts
  • Loading branch information
matthewp authored Jul 27, 2018
2 parents 468352e + 6b1a534 commit 10da38b
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/extension-no-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,12 @@ addStealExtension(function (loader) {

return loaderImport.apply(this, arguments);
};

var loaderModule = loader.module;
loader.module = function() {
var p = loaderModule.apply(this, arguments);
this.module = loaderModule;
clearTimeout(this._noMainTimeoutId);
return p;
};
});
8 changes: 8 additions & 0 deletions steal-with-promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -6789,6 +6789,14 @@ addStealExtension(function (loader) {

return loaderImport.apply(this, arguments);
};

var loaderModule = loader.module;
loader.module = function() {
var p = loaderModule.apply(this, arguments);
this.module = loaderModule;
clearTimeout(this._noMainTimeoutId);
return p;
};
});

addStealExtension(function(loader) {
Expand Down
2 changes: 1 addition & 1 deletion steal-with-promises.production.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions steal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5519,6 +5519,14 @@ addStealExtension(function (loader) {

return loaderImport.apply(this, arguments);
};

var loaderModule = loader.module;
loader.module = function() {
var p = loaderModule.apply(this, arguments);
this.module = loaderModule;
clearTimeout(this._noMainTimeoutId);
return p;
};
});

addStealExtension(function(loader) {
Expand Down
2 changes: 1 addition & 1 deletion steal.production.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/main-warn/script-inner.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
data-base-url="."
data-config="package.json!npm">

import "~/main";
require("~/main");
</script>
<script>
steal._mainWarnMs = 10;
Expand Down
2 changes: 1 addition & 1 deletion test/main-warn/steal-module.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
data-base-url="."
data-config="package.json!npm"></script>
<script type="steal-module">
import "~/main";
require("~/main");
</script>
<script>
steal._mainWarnMs = 10;
Expand Down
8 changes: 8 additions & 0 deletions test/steal-with-promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -6789,6 +6789,14 @@ addStealExtension(function (loader) {

return loaderImport.apply(this, arguments);
};

var loaderModule = loader.module;
loader.module = function() {
var p = loaderModule.apply(this, arguments);
this.module = loaderModule;
clearTimeout(this._noMainTimeoutId);
return p;
};
});

addStealExtension(function(loader) {
Expand Down
2 changes: 1 addition & 1 deletion test/steal-with-promises.production.js

Large diffs are not rendered by default.

0 comments on commit 10da38b

Please sign in to comment.