-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This should probably work in an ES5 app #11
Comments
Ultimately, I'd like to try to follow the main and module pattern described here. Emulating the Angular pattern described in that post or emulating moment might look like: {
"name": "esri-loader",
"main": "./dist/esri-loader.umd.js",
"module": "./esri-loader.js",
···
} Where But, there are a few problems w/ this. First, we should rename the the source to "esri-loader.ts" (I regret using "index.ts" - the only reason I did was b/c I thought TS consumers would be able to load the TS code directly). However, other libs like angular2-esri-loader have caused their own dependencies to depend on this library. In theory as long as the module loaders (like webpack) used in those apps respect the above package.json fields, we should be able to move the files around, but I had a nightmare figuring out how to get it successfully published in the first place, I'm really hesitant to remove the one thing I know works (./index.js as a CJS module). Also, it looks like
I really can't understand why everyone loves TypeScript. That seems like more likely reason that I was seeing Angular libraries use webpack to do their builds. Looks like I'm going to have to add a real build pipeline here. |
OK, I take back half of what I said about TS - it may be the source of the problem (in that the UMD build was not consumable), but at least it seems to be part of the solution. Despite what the above docs say, you can use 🤞 that this will actually work in all environments. |
B/c this outputs to CJS there are exports statements in the built code (https://unpkg.com/esri-loader@0.1.3/index.js) this won't work in ES5. I tried pulling the build output into Ember via bower and it chokes on the exports.
Seems like CJS was needed for Angular dc92251. It may be that the
tsc
UMD build output was problematic for Angular (now starting to see why other libs use webpack instead oftsc
to do builds).Would love to know that the right pattern is here.
The text was updated successfully, but these errors were encountered: