johnsoftek / plugin-jade

Jade loader plugin for jspm
MIT License
13 stars 5 forks source link

Bundle doesn't work #2

Closed davidblurton closed 9 years ago

davidblurton commented 9 years ago

I get the follow error when I run jspm bundle

Potentially unhandled rejection [6] TypeError: Error loading "templates/posts.jade!github:johnsoftek/plugin-jade@1.9.0" at <unknown>
Error loading "templates/posts.jade!github:johnsoftek/plugin-jade@1.9.0" from "js/app" at file:/Users/David/Aranja/aranja.com/app/js/app.js
Error loading "github:johnsoftek/plugin-jade@1.9.0/jade-compiler.min" at file:/Users/David/Aranja/aranja.com/app/jspm_packages/github/johnsoftek/plugin-jade@1.9.0/jade-compiler.min.js
Execution must define a Module instance

I'm calling the module as follows

import template from 'templates/posts.jade!'

export default data => data.forEach(post => {
  var element = document.getElementById('facebook-feed')
  element.innerHTML = template({
    posts: data
  })
})

Possibly related issue https://github.com/systemjs/builder/issues/22

aams commented 9 years ago

@davidblurton I'm guessing you are correct in relating this issue to systemjs/builder#22. The plugin includes the browserified version of the Jade compiler and runtime. There were two reasons to use those versions: . a jspm or systemjs problem respecting "main" in package.json . the size of the included full Jade npm package

I am on holidays but I will try using the full Jade npm package as soon as I can.

gavriguy commented 9 years ago

+1 I have the same problem when trying to bundle

johnsoftek commented 9 years ago

@guybedford I created a new branch, npm-jade to overcome this bundle error, possibly due to use of the browserified versions of Jade compiler and Jade runtime.

Steps to reproduce. In a new directory:

results in error:

err  Error: Error loading "test.jade!github:johnsoftek/plugin-jade@npm-jade" at <unknown>
     Error loading "test.jade!github:johnsoftek/plugin-jade@npm-jade" from "app" at file:/Users/john/tmp/pj2-test/app.js
     Error loading "@empty" at file:/Users/john/tmp/pj2-test/@empty.js
     Error loading "@empty" from "github:johnsoftek/plugin-jade@npm-jade" at file:/Users/john/tmp/pj2-test/jspm_packages/github/johnsoftek/plugin-jade@npm-jade.js
     ENOENT, open '/Users/john/tmp/pj2-test/@empty.js'

Any ideas?

guybedford commented 9 years ago

@johnsoftek are you using the latest version of jspm?

johnsoftek commented 9 years ago

@guybedford I was using 0.11.0. Same error on 0.11.3

guybedford commented 9 years ago

Ok thanks, I've fixed this in SystemJS builder 0.7.2, should get that with npm install -f jspm (https://github.com/systemjs/builder/commit/cbfc0c8890dc82613f6fa3532408c9e1cb3ed98d).

johnsoftek commented 9 years ago

@guybedford Yes. That fixed it.

I had to make some changes to my test files to make a working bundled version. Not yet updated on Github.

When will npm be updated so that npm install jspm will install the correct versions?

johnsoftek commented 9 years ago

@davidblurton @gavriguy Bundling now works for me. Please try it out.

Note that, for now, you will need to force the correct version of systemjs by installing jspm-cli like so: npm install -f jspm

davidblurton commented 9 years ago

Thanks, will test it out at the weekend.

On 5 Feb 2015, at 13:54, johnsoftek notifications@github.com wrote:

@davidblurton @gavriguy Bundling now works for me. Please try it out.

— Reply to this email directly or view it on GitHub.

gavriguy commented 9 years ago

Works like a charm :+1:

johnsoftek commented 9 years ago

@gavriguy. Great.

Please note that in new version, 0.3.0, you no longer need to install jade-runtime.The plugin installs the runtime.