Comments (9)
@jiggliemon can you provide more context on how that require('') call is done? Is it inside a module, or at the top level, outside a module? If outside a module, then I expect it to fail, since the loader can only find dependencies of that type inside a module.
from cajon.
@jrburke
This is essentially my simple
setup:
https://gist.github.com/3208730 && https://github.com/jiggliemon/yayo/tree/master/www
Since you can load other modules in the sync fashion, I would expect to be able to also load files with a plugin dependency in the same style.
Are my expectations incorrect?
from cajon.
Yes, this should work, and I confirmed with a simple test locally, however, my config is done before the loading of simple, and I was not using package config. Based on the config in the gist, the template file should be at 'js/tmpl/simple.tmpl'. If it is not, and it should be inside the simple package, then using 'text!./tmpl/simple.tmpl' should work better.
You can check the network tab in the browser developer tools to see what path was used to try to fetch the template. I am suspecting the issue is related to that.
from cajon.
@jrburke You can see the directory structure here:
https://github.com/jiggliemon/yayo/tree/master/www
the template file is sitting in js/tmpl/simple.tmpl
What i found interesting from monitoring the network tab, was that the text.js plugin never loaded, also there's no attempt to request the template. See the network tab here:
http://cl.ly/image/3F3A3d1y3G2X
from cajon.
Ah, so this was a weakness in how cajon was constructed -- the config call and its fetch for deps happens before cajon's requirejs.load method was set up, so the old requirejs one was used by mistake. I just did a fix and pushed 0.0.4 with the fix.
from cajon.
Once this problem was fixed, I noticed another load problem, but due to the packages config. in requirejs, the default "main" is assumed to be a "main.js", but at least one of your packages uses "index.js", so you will need to configure the package's main property to be main: 'index' for it to work:
http://requirejs.org/docs/api.html#packages
from cajon.
I hadn't pushed my changes to the dependencies yet. However I usually put in a main.js file with the following:
define(['./index'],function (o) { return o })
Im not sure if this is related to the fix you implemented for 0.0.4, or just presenting itself since the template is now working. But the module config isn't working: http://requirejs.org/docs/api.html#config-moduleconfig
As seen being attempted here: https://github.com/jiggliemon/yate/blob/master/src/index.js#L4
I should prob open another issue?
from cajon.
Here's the error for attempting to use require('module'):
from cajon.
Looks like require('module') is a generic issue in requirejs. I filed this issue to track that:
In this case though, it is simple enough to just use var config = module.config()
since module is one of the default variables available for a module in cajon.
from cajon.
Related Issues (15)
- 'use strict' causing script loading errors. HOT 2
- Support require([js-data-uri]); HOT 1
- Cajon treats CoffeeScript compiler as a CommonJS module HOT 1
- Require-CS not working with Cajon HOT 3
- Remove Query from path in debugger... HOT 1
- Upgrading from 0.1.14 -> 0.2.4, `global` should be defined HOT 6
- `exportsPropRegExp` should also check for array notation.
- "exports is not defined" HOT 2
- Backbone shim HOT 4
- Not working with handlebars via the requirejs-handlebars plugin? HOT 3
- Evaled scripts show up under (no domain) in chrome
- Conditional comments around sourceUrl comment causing grey hair HOT 3
- Code has to be evaluated in global scope HOT 5
- Cajon is not available via Bower HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cajon.