Comments (17)
OK, v3.1.0 has been released just now with our new tag based router 🎉
from route.
@GianlucaGuarini that's exactly why I've separated it into two. Ok, but I don't want to push it more. I was just looking for a simpler solution 😑
Let's go with one package with two js files in the root dir:
lib/tag.js
forimport route from 'riote-route/lib/tag'
tag.js
forconst route = require('riot-route/tag')
dist/route+tag.js
dist/amd.route+tag.js
and existing these files:
lib/index.js
dist/cjs.route.js
dist/route.js
dist/amd.route.js
Looks ok?
Updated: es.tag.js
--> lib/tag.js
for the future compatibility
from route.
@karantir sounds interesting. How about simply making seperated <lazy>
loading tag?
<app>
<router>
<route path="fruit/*"><inner-tag /></route>
<route path="veggie/*"><lazy src="tags/lazy-inner-tag.tag" /></route>
</router>
</app>
I think we don't have to couple the router and lazy loader, at this point.
from route.
I like the idea of having require('riot-route/tag')
but I am not sure what it should return though.
Another thing to consider is the new riot-hot-reload
feature that will land soon in riot riot/riot#2095, how will these new features work together?
from route.
@GianlucaGuarini I like the idea require('riot-route/tag')
, too. But I don't know any good way to provide the code for ES6. jsnext:main or module in package.json
is the way to do that but only for the main module of the package.
Alternatively we could use .mjs
extension for ES6, but it seems fading away from the proposal...?
const route = require('riot-route/tag')
import route from 'riot-route/tag.mjs'
BTW, the discussion below seems changing day by day. So I've started thinking about the option to have two npm packages.
I'm not sure about hot reloading, but it should work. The tags are basically just normal Riot tags 😄
from route.
@cognitom I would just compile the riot tags in a bundle and provide them under riot-route/tag
. You can compile them using riot -m
and you will get UMD wrappers ready for the dist version. I wouldn't even think aboutmain:next
from route.
@GianlucaGuarini UMD doesn't support ES6 modules...
Could you check ES6 and CJS?
It could not be an option to provide the naked tags for ES6/CJS (rollup/webpack/browserify) without compilation, either. Because there's no interoperability between them at this point.
from route.
I thought rollup could handle also handle CJS https://github.com/rollup/rollup-plugin-commonjs.
from route.
this file also does not really make sense. In case our users don't use a bundler we can assume that route (or riot.route
) and riot are globally available
from route.
@GianlucaGuarini thanks for your feedback! I thought this:
<script src="https://cdn.jsdelivr.net/riot/3.0.5/riot.js"></script>
<script src="https://cdn.jsdelivr.net/riot-route/3.1.0/route-tag.js"></script>
would be better than this:
<script src="https://cdn.jsdelivr.net/riot/3.0.5/riot.js"></script>
<script src="https://cdn.jsdelivr.net/riot-route/3.1.0/route.js"></script>
<script src="https://cdn.jsdelivr.net/riot-route/3.1.0/route-tag.js"></script>
There's no use case we use route-tag.js
separately in the latter case. (remember that we're not hosting compiler.js
in riot/riot
any more)
How about route+tag.js
instead of route-tag.js
?
from route.
Yeah, Rollup could handle CJS but I just don't want to... 😭
Anyone would use CJS in frontend projects in 2017?
from route.
@cognitom You know what? At this point I would prefer a separate repo for the route-tag
and I would call it something like riot-pequod
or riot-nautilus
to make its name a bit more appealing and less sad than route-tag
. In that repo you could simply add the riot-route
and riot
as dependencies. I guess it does not make sense for other users using only riot-route
without riot, to have the riot dependency just because a sub-package of riot-route
uses custom tags.
from route.
@GianlucaGuarini thanks!
I've rebranched as feature/route-tag and cleaned it up 😄
from route.
Related to this issue, I've sent rollup/rollup-plugin-node-resolve#69. If it has been accepted, we'll be able to write simply like this:
import route from 'riot-route/tag'
from route.
congrats good job @cognitom
from route.
Is there a plan to implement lazy loading/compiling for inner tags? Something like that:
<app>
<router>
<route path="fruit/*"><inner-tag /></route>
<route path="veggie/*" tag="lazy-inner-tag"></route>
</router>
</app>
from route.
Closing this issue because it's related to an old router version. Please update to the latest @riotjs/route
version if you can.
from route.
Related Issues (20)
- Do TypeScript definitions exist for route? HOT 1
- Router fails entirely when not in index of a folder HOT 1
- When trying to put a component inside a route it is not mounted. HOT 4
- Import route / router fails on Edge after rollup bundler HOT 4
- Using router with rollup causes error HOT 1
- Infinite loop when child is directly nested in route HOT 1
- Child component onUpdated not firing
- Exclude path from routing HOT 2
- Route function rather than Update HOT 1
- How to catch "404 Not Found" routes properly? HOT 3
- "Maximum call stack size exceeded" error and a component inside route component are mounted multiple times
- Bug in support of 'target' attribute HOT 3
- Disable setting history. HOT 3
- Can't get routes with parameters to work HOT 1
- use decodeURI() on route HOT 5
- setBase is working? HOT 1
- Download a file HOT 2
- Error when compiling webpack HOT 3
- Updating component on route change HOT 3
- Router captures all links regardless of base path HOT 3
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 route.