uri-template-router icon indicating copy to clipboard operation
uri-template-router copied to clipboard

[Improvement] Module type

Open Lcfvs opened this issue 6 years ago • 2 comments

Hi again,

Since a router can be used both in front/back, it can be useful to use it as a ES6 module, preferably without any package bundling requirement.

Any chance to make it as an ES6 module?

Lcfvs avatar Nov 27 '19 05:11 Lcfvs

@Lcfvs Is that well supported by Web browsers and Node.js these days? I'm really not sure what the advantage is over e.g. Browserify

awwright avatar Nov 27 '19 18:11 awwright

@awwright [email protected] already supports the ES modules For the browsers: https://caniuse.com/#search=module

Browserify, Webpack, Parcel & others are fine, but the it's a few boring to be forced to use them where the modern features provide a way to load our resources without that extra process.

Lcfvs avatar Nov 28 '19 11:11 Lcfvs

Afaict Node v22.4.0 still doesn't support ES modules:

SyntaxError: Cannot use import statement outside a module

and

SyntaxError: Unexpected token 'export'

So this still requires a feature flag of some sort

awwright avatar Jul 16 '24 22:07 awwright

So this still requires a feature flag of some sort

Just add "type": "module" into your package.json ;)

Lcfvs avatar Sep 03 '24 14:09 Lcfvs