diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -696,12 +696,6 @@ Pagelet.on = function on(module) {
     ? path.resolve(dir, prototype.error)
     : path.resolve(__dirname, 'error.html');
 
-  //
-  // Map all dependencies to an absolute path or URL.
-  //
-  if (prototype.view) prototype.view = path.resolve(dir, prototype.view);
-  Pagelet.resolve.call(this, ['css', 'js', 'dependencies']);
-
   return module.exports = this;
 };
 
@@ -733,6 +727,7 @@ Pagelet.optimize = function optimize(options, next) {
   // Ensure we have a custom error page when we fail to render this fragment.
   //
   if (prototype.view) {
+    prototype.view = path.resolve(prototype.directory, prototype.view);
     options.temper.prefetch(prototype.view, prototype.engine);
   }
 
@@ -741,6 +736,11 @@ Pagelet.optimize = function optimize(options, next) {
   }
 
   //
+  // Map all dependencies to an absolute path or URL.
+  //
+  Pagelet.resolve.call(this, ['css', 'js', 'dependencies']);
+
+  //
   // Support lowercase variant of RPC
   //
   if ('rpc' in prototype) {
[fix] resolve inside optimize not .on as its optional