olado/doT

es6 module version?

erichanson opened this issue · 7 comments

Now that the world seems to be settling into es6 modules, it would be really great to have a version of doT that could be imported using an import statement.

as long as there is 3% or more of ie 11 users we can't.

Well, it wouldn't need to replace the backwards-compatible version. Just be a forward-thinking thing, available for those who want to use doT in a more bleeding-edge project. IE11 end-of-life is scheduled for 2025!

2025 seems like a good time to start looking at import as it won't affect users.

Developers are users too. If you don't value evolving towards emerging standards, this wouldn't be of much use to you, but developing a .module.js version of libraries is quickly becoming common place...

@erichanson Not for professional developers: that have users. For example, jquery v4 to be released will drop support for ie 10 but support ie11. Next major version of bootstrap will drop support for ie 10 but support ie 11. Their future yet unreleased versions for both, that is not even in alpha yet: will support ie 11. These are two of the top most popular packages used by developers and users and their stated future plans. Why? Because a pro developer is required to fight for market share, that is how a business pays our salaries. There are libs that support both module and es5 and there are libs that are only es6 - but developers have to migrate of those libs. Till 2025 or till ie 11 goes < 1% of users. You can't go to your boss and say hey next month we plan to drop our revenue by 3%. Business expects growth, that is what they tell the investors and pensions funds. Neither can I use a deprecated older lib, it must appear supported. Business rules. It is not different than having to support older version of Android SDK. As long as market share is > 1%, we have to support and test for it. hth.

You can make it supporting import and still work with require.
It would require ES6 test (that would only run in node 12 with a flag - so travis needs to be configured to use this flag with v12 and the test has to be excluded in other versions).

PR is welcome. Assuming it’s not a breaking change can be in current version.

in v2