-
Notifications
You must be signed in to change notification settings - Fork 249
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
issue/2824 Replaced requirejs with rollup for module bundler #2827
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
Just to note that the TypeScript compiler should be able to transpile down to ES5 by itself, so there shouldn't be any need to run it through babel as well. Honestly though, don't worry too much about trying to include support for TypeScript - I think getting support for React in Adapt would be a far bigger win. |
I also had to make two custom AST transformation which are really easy to do in babel, for amd to ES6 and for jsx templates. Hopefully by the time we've converted everything over to ES6, typescript will have matured to a level where making transformation plugins is as easy as it is in babel. If we limit the stack through rollup, babel and react then it leaves Typescript as a future possibility as the sole compiler. I couldn't get it to transpile from ES6 > ES5, the |
Yea, I was missing |
This was a reasonably good article on the subject: https://iamturns.com/typescript-babel/ I was kind of aiming for what I remember you wanted, which was typing on compile. So none of the options I could find really came together without a compromise but it did look promising a few times and was really exciting to see the intellisense light up properly in vscode - and boy did it light up, was amazing. I think what I'd prefer to see is a proper typescript plugin for babel, not just a stripper. |
closed in favour of #2829 |
#2824
Will provide an almost seamless migration away from build-side requirejs and AMD modules to ES6 modules
Facilitates
import
andexport
directivesvar Adapt = require('core/js/adapt');
etc will still workDownsides
js
folderAdded
<%= outputdir %>/.cache
to speed up compilation times--disable-cache
to disable the cache and recompile from scratchRemoved
config.js
file has been moved to thejavascript
grunt task configFixed
QuestionView
has two differentreturn
statements, so cannot resolve to oneexport default
directiveTesting
Example
Shows fast compilation times,
import
/export
, debugging andrequire
functioning with an ES6 module in the client-side:Other
See a variant with added typescript support https://github.com/adaptlearning/adapt_framework/tree/issue/2824-ts with added command
npm run check-types
, it's a fair bit slower than the babel-only variety because it has to get processed by two compilers.See a variant with added react support #2829 - I am very keen to get this in, it would mean we could ditch jQuery for DOM modification and we'd get a lot more flexibility as views will automatically rerender themselves on model changes.