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
Enhancement Request: Custom Builds using Typescript Compiler #6494
Comments
Very interesting! |
Agreed, I also find this interesting. But I don't understand the size comparison i.e the reference to a 91k ol-debug.js doesn't seem right to me? |
@bjornharrtell Those were line counts so roughly 1.4MB vs 2.5MB uncompressing. |
@ca0v I have not tried, and I don't know how Rollup would fit into your stack. But https://github.com/rollup/rollup-plugin-commonjs (and similar tools) should be able to help here. Just so you know, That said, please keep us posted on any findings that make the ol package work with the TypeScript compiler. |
@ahocevar rollup might do it because the rbush project cannot use es6 syntax due to a browserify limitation (see mourner/rbush#66 (comment)). @morner might consider use tsc instead although I'm not sure how that would work. Maybe: |
what exactly is the 'enhancement request' here? OL uses 5 external 'modules': the 4 in I'm currently exploring using the ES-module OL version directly in the browser, and as part of this have created a custom version of proj4js and rbush replacing the UMD wrapper with an ES one. I could make these available for use in other environments, such as TS if that can't handle the current CJS import. Alternatively, there are tools like https://github.com/nolanlawson/cjs-to-es6 which enable you to convert CJS modules to ES (with various caveats, as it's not a simple 1-to-1). I view these though as short-term fixes. ISTM the long-term solution is for the upstream packages to provide the code in ES module form. I don't see much that OL can do ATM other than provide short-term hacks. |
@probins The 'enhancement' is to allow TSC to build OL projects without modifying the dependencies. The implications of using TSC to build the transpiled code instead of browserify means asking multiple project owners to experiment with something that might not work. I can only say it worked for a very simple demo using 4.0.1 and if it works in the larger picture would simplify the build process (tsc will transpile and concatenate) for typescript developers. As an aside, typescript delivers freedom through constraint that ol developers might come to love nearly as much as their unit tests. |
The es6 module migration is now complete, closing |
I created a custom openlayers 4 build using typescript and amd (https://github.com/ca0v/ol4-lab) but had to tweak rbush/quickselect because, unlike ol, it cannot support es6 syntax. This was the only thing preventing a basic custom build using nothing but tsc.
The text was updated successfully, but these errors were encountered: