visionmedia / page.js

Micro client-side router inspired by the Express router

Home Page:http://visionmedia.github.com/page.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CommonJS "require()" in page.js file loaded from browser

wollanup opened this issue · comments

Just to make sure...
Is that an expected behavior that page.js uses

var pathtoRegexp = require('path-to-regexp');

in the latest commit ?

The file page.js is supposed to be used in a client side environment (browser), not in Node environment ?

i have the same problem.

TLDR - Use the cdnjs or unpkg links on the README, not the rawgit link on the public marketing site. Keep the version at 1.11.1

This is not ES6, this is commonjs and certainly has no place in the built file of a client-side library. The tests don't catch it either, so, must be configured incorrectly or else it is going through another build stage for them.. which would make even less sense. Hopefully someone with time (unfortunately not I) can dig into it more today, because this is probably affecting a lot of people.

@bbarr
Yes I switched to
https://unpkg.com/page@1.11.1/page.js
instead of
https://cdn.rawgit.com/visionmedia/page.js/master/page.js
(and told my devs again to never use untagged/master versions! 😠 )

You're right about CommonJS, I have confused require() with import, updated title ;)

...just before the weekend :/
Had to switch from the master-version as well. grrrrmpfff

Not sure why this happened. Looking into it.

Ok, this is fixed in 1.11.2. Sorry about that.

Thanks.