Closed mxstbr closed 8 years ago
Hi! It sounds like this overlaps with the request I have:
/components
, which is part of our application's routes.It sounds like this is possible, based on the internals I took a cursory look at.
Is this issue for the same feature?
Is this issue for the same feature?
Not entirely sure from your explanation, what exactly do you mean with "but would want to "embed" it within the app."?
Currently you can change the route from localhost:3000/carte-blanche
to localhost:3000/components
, but I'm not entirely sure that satisfies your use case.
@mxstbr I think we should write a carteBlancheMiddleware like webpackDevMiddleware
or webpackHotMiddleware
. If people initialize it like that: app.use(carteBlancheMiddleware(compiler))
we can check check for the path and emit the right file. I think it's important to use a middleware, because then we also can emit the client, user-bundle and other assets we might need in the future.
Here some resources:
The code to submit the assets as of now: https://github.com/carteb/carte-blanche/blob/master/webpack-plugin/src/apply.js#L64
@mxstbr sounds like an issue for me (again) 😆
Sorry I wasn't clear. @nikgraf's recommendation for carteBlancheMiddleware
is what I was inquiring about. (I have an existing Express server running that I'd like to have serve /components
from Carte Blanche from within the same instance).
The nice thing about middleware is you can remove the path option by doing:
app.use("/components", cartBlancheMiddleware(compiler))
Anyway, I'll be testing the project out this week & hopefully be able to help. <subscribed>
& hopefully be able to help
That's what we love to hear!
I've pushed up a first (not yet working) express.js example to the express-integration
branch—as soon as that's actually working you'll be able to run it with npm run example:express
.
Done with v0.2! :tada:
What we do under the hood is emitting a new asset from webpack at
carte-blanche/index.html
. (or whatever you specify in thedest
option) This means that if you're using express.js for routing, users will never find the Carte Blanche because express.js sends back a 404.We should be exposing an easy-to-use route which redirects to Carte Blanche. I've never done this before, so maybe there's a better way, but this seems like the nicest solution at the moment: