Option to not add a .js extension to dependency module
See original GitHub issueI’m submitting a feature request
- Library Version: 0.18.0
- Operating System: OSX 10.x
- Node Version: 6.2.0
- NPM Version: 3.8.9
- Browser: all
- Language: TypeScript 1.9
Current behavior:
When adding a dependency to the aurelia.json
file it automatically adds a .js extension. I’m running into the issue of trying to load the square javascript library which can only be used with their cdn. The cdn url does not have a .js
extension https://js.squareup.com/v2/paymentform
.
Expected/desired behavior: Have an extra option field where you can disable the adding of the .js extension or maybe a cleaner way to let the bundler know not the add the .js extension.
What is the motivation / use case for changing the behavior?
Trying to add payment processing to my app using square (https://squareup.com/). They don’t allow their library to be used outside of their cdn so they don’t have any npm
or bower
modules. I’ve tried adding a script tag in my index.html
page but I can’t use the library inside any of my classes since Aurelia does not know of the global variables from that file. I tried adding it to my dependencies like so:
{
"name": "paymentform",
"path": "https://js.squareup.com/v2/paymentform",
"exports": "SqPaymentForm"
},
But since Aurelia adds the .js extension it never finds the link
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (11 by maintainers)
Current cli doesn’t support deps defined with path starting with
http(s)://
. It could be some dropped feature since v0.18.0.I am pretty sure the previous feature uses requirejs config paths, where requirejs adds “missing”
.js
. That’s not in our control.However, that js lib is in legacy format, only suppling a global var
SqPaymentForm
, it should be loaded by prepend instead.Unfortunately cli’s prepend doesn’t support remote link.
The successor of cli bundler, dumber bundler does support remote url in prepend and append. I tested it, confirmed
"https://js.squareup.com/v2/paymentform"
works without the annoying.js
.I don’t think this is in our control, it’s the default behavior of requirejs when loading module from remote.
Update: I think I misunderstood. Is this some js code loaded by prepend? Nvm, I will have a look in a day or two.