Skip to content

Commit

Permalink
check src existence
Browse files Browse the repository at this point in the history
  • Loading branch information
chasegiunta authored Sep 8, 2023
1 parent f051ed6 commit 4cf48e9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ function generatePreviewHead(parsedConfig) {

for(const key of Object.keys(parsedConfig)) {
for(const value of parsedConfig[key]) {
if(key == 'script' && value.src) {
if(value.src.indexOf('ember-cli-live-reload.js') > -1) {
if(key == 'script') {
if(value.src && value.src.indexOf('ember-cli-live-reload.js') > -1) {
doc.push(`<script>
(function() {
var srcUrl = null;
Expand All @@ -144,7 +144,7 @@ function generatePreviewHead(parsedConfig) {
continue;
}
doc.push(`<${key} ${objectToHTMLAttributes(value)}></${key}>`);
if(value.src.match(/assets\/vendor[^.]*\.js/)) {
if(value.src && value.src.match(/assets\/vendor[^.]*\.js/)) {
// make sure we push this right after vendor to ensure the application does not bind to the window.
doc.push('<script>window.Ember = require("ember").default; runningTests = true; Ember.testing=true;</script>');
}
Expand Down

0 comments on commit 4cf48e9

Please sign in to comment.