-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot initialize router when used via CommonJS #332
Comments
Join the question. |
I do it this way, and it works. import {Router} from 'director'
class Routing {
constructor() {
let router = Router({
'/': this.index,
'/route/': this.route
});
router.init();
}
index() {
console.log('index')
}
route() {
console.log('route')
}
} |
Try Look into |
+1.查看代码后才知道是这么玩 |
I just ended up using sheet-router on the client and server-router on the server. Quite simple. |
This commit replaces the "director" module with "director/build/director". Per this issue: flatiron/director#332
This commit replaces the "director" module with "director/build/director". Per this issue: flatiron/director#332
This commit replaces the "director" module with "director/build/director". Per this issue: flatiron/director#332
|
Hey folks, I've been trying to debug this for the past hour but have decided it may not be just me.
Yields the error
router.init is not a function
onindex.js:19
.The documentation isn't quite clear on whether
init()
is necessary, so I tried without that line and the error goes away but the router doesn't appear to have any effect (nothing is logged). I also tried withoutnew
, but it tells methis.configure is not a function
.I'm trying to use this within an electron app, which has native support for
require()
, though I can't imagine it's any different than using a bundler like browserify/webpack. Any advice on how to use this lib?The text was updated successfully, but these errors were encountered: