Closed CreativeOutbreak closed 1 year ago
I am having the same issue, but am indeed including jQuery.
My own problem was just solved by ensuring I ran script concatenation and minification BEFORE launching the criticalcss task. I may have somehow edited my js files without reprocessing them through my normal suite of grunt js-related tasks, and my default task queue runs criticalcss before touching js. Hopefully @CreativeOutbreak will find a solution!
@CreativeOutbreak @timrourke Did you find out why jQuery.extend was breaking phantomjs?
I am having this issue also on a Drupal 7 site.
Error Message:
Something went wrong with phantomjs...
Fatal error: PHANTOM ERROR: ReferenceError: Can't find variable: jQuery
TRACE:
-> http://example.dev/: 698 (in function global code)
My code:
criticalcss: {
home: {
options: {
url: 'http://example.dev/',
width: 1400,
height: 900,
filename: '../css/style.css',
outputfile: '../css/critical-home.css',
buffer: 1000000*1024,
ignoreConsole: true
}
},
blog: {
options: {
url: 'http://example.dev/blog/blog-post-title/',
width: 1400,
height: 900,
filename: '../css/style.css',
outputfile: '../css/critical-blog.css',
buffer: 1000000*1024,
ignoreConsole: true
}
}
}
To follow up on my issue. I was using the Drupal module AdvAgg (Advanced Aggregation) and had a setting to defer all JavaScripts.
Not deferring/a-syncing the JS resolved the issue for me.
(Thanks to this unrelated issue!)
I have this error too, due to a global variable that is available in real life but Phantom doesn't see it for whatever reason, so causes an error.
Also, any [Vue warn] will cause a Phantom error and stop compiling
So I can fix the error by declaring the variables again, but that's ugly so is there a way to ignore this error in criticalcss itself, similar to ignoreConsole?
Hi, I'm trying to use this on a drupal site I'm currently developing, but I'm getting the following error:
Fatal error: PHANTOM ERROR: ReferenceError: Can't find variable: jQuery TRACE:
I'm not using jQuery on the site its self, but presume this isn't the problem?
Any ideas?