All CommonJS and AMD modules to be transpiled#1513
Conversation
This enables AMD and CommonJS modules to also be transpiled (run through Babel). Still a little bit of a WIP. Closes #1276
| } | ||
|
|
||
| loader.transpile = function (load) { | ||
| // TODO this needs to change |
There was a problem hiding this comment.
Now that .transpile() is called on all formats, prependDeps needs to check the load.format.
| System.ext = Object.create(null); | ||
| System.logLevel = 0; | ||
| System.forceES5 = true; | ||
| System.transpileAllFormats = true; |
There was a problem hiding this comment.
Not sure if this is the right option. In the PR we said transpile would be it.
Also this has to default to false or it will be a breaking change.
There was a problem hiding this comment.
steal.loader.transpile is a function that's used to do transpilation. We could support the transpile: true option, but this would be tricky to implement. I don't think a slightly better name is actually worth it and transpileAllFormats is just fine.
|
There are a few issues with this PR but it basically works. Also need to test against steal-tools as I'm not sure what the implications this might have on that. |
|
Need a way to test this. My thought: Have a custom babel plugin. Maybe it could change a function signature in some way. We would know that it works by calling same function. For example: module.exports = function() {
return 1;
};Transpiles to: module.exports = function() {
return 2;
};But only for a certain module. Seems reasonable. |
This enables AMD and CommonJS modules to also be transpiled (run through Babel). Still a little bit of a WIP. Closes #1276