Not able to Progressively load stache file

Test Case: https://github.com/shaunstepanowich/stealjs-jquery-issue1

Test Case is a nodejs app using express as the web server.

Steps:

  1. Clone repo, run npm install
  2. Run: grunt build
  3. Run: node app.js (server is on localhost:8080)
  4. click “click me”
  5. In console in browser you’ll note the following:
    Uncaught SyntaxError: Unexpected token <

If i’m running steal without the optimizer everything works fine.
If i include the second stache file into the optimizer it also works fine.

Could the problem be that this module seems to be emptied in the dist?

Why would this be set to empty, to avoid double processing?

define('can@2.3.22#view/stache/system', [], function(){ return {}; });

Why are you doing:

steal('foobar/AnotherTemplate.stache',function(another){
                
                var viewFrag = can.view(another);
            
                me.element.empty();
                me.element.append(viewFrag);                
                
            });

? If you want progressive loading, you should do this with System.import. If you want to make this a static dependency, put 'foobar/AnotherTemplate.stache' in your original steal imports…

Btw, use a different module format with the new steal if possible. It’s deprecated.

I am trying to do progressive loading.

Thanks for pointing me at the System.import stuff. It looks like I’m still having the same problem.

I have updated the test case with the following changes:

  1. Switched to System.import for progressive loading stache file
  2. Switched steal calls to define.

I am still getting the same error:

Uncaught SyntaxError: Unexpected token <

You might need to end the import name with !

Added that to the test, does not appear to be working.

Thanks.

is your gihub repo up to date? i will look into it

yes it up to date with all the changes

This has been resolved, repo has been updated to reflect changes

problem:
can/view/stache/system is empty in production build of can

Correct fix:
Do not import stache file directly, import a js file that has been correctly referenced as a bundle

Work around:
import can/view/stache/system so that is available in production dist

I created an issue for this

https://github.com/stealjs/steal/issues/657

The bundle config is the right work around, which isn’t really a work around.