path-to-regexp loader for Webpack
How to Install
npm install path-to-regexp-loader --save-dev
How to Use
Given a routes.json
file that may look like this:
You can parse it by using path-to-regexp-loader
:
var routes = ;// => returns routes.json content as JSON parsed object
path: '/tasks' pattern: /^\/tasks?$/i keys: component: 'TodoList' path: '/tasks/:id(\\d+)' pattern: /^\/tasks\/?$/i keys: name: 'id' prefix: '/' delimiter: '/' optional: false repeat: false partial: false asterisk: false pattern: '\\d+' component: 'TodoItem'