![]() ![]() Import svelte from 'rollup-plugin-svelte' import resolve from 'rollup-plugin-node-resolve' import commonjs from 'rollup-plugin-commonjs' import livereload from 'rollup-plugin-livereload' import replace from 'rollup-plugin-replace' import babel from 'rollup-plugin-babel' export default Install dependenciesįirst let’s install the required babel packages, and the rollup plugin. The following configuration has worked for me, successfully transpiling my cordova app. According to this svelte GitHub issue, it’s still a WIP to list exactly what needs transpiling / polyfills. With this release, the polyfill has been removed, and you will need to supply it yourself if your environment needs it.Īnother is svelte. Up until the 0.6.0 release ES6 Promise was being polyfilled using es6-promise. Unfortunately, not all libraries abide by this rule. Consumers of your library should not have to transpile your ES6 code, any more than they should have to transpile your CoffeeScript, ClojureScript or TypeScript. We encourage library authors not to distribute code that uses untranspiled ES6 features (other than modules) for this reason. Ideally, you should only be transforming your source code, rather than running all of your external dependencies through Babel – hence the exclude: ‘node_modules/**’ If they were published with ES6 syntax, then they’ll cause your bundle.js to contain untranspiled code.īy the way, here is babel’s take on external dependencies: Your dependencies are also code that’s bundled along with your app. If you’re using ES6 and above in your app (and you should), you need to transpile that. We’re going to use babel of course, in order to transpile.īabel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments.īut which code needs to be transpiled? We need to consider two levels of transpilation: 1. I wrote more about WebView versions in the post: should you transpile your cordova app What should be transpiled? This is meaningful especially for a cordova app, because it runs in a system WebView, which version depends on various factors, and is not always updated. One such issue is transpiling your code to work on older browsers. When working with a relatively new framework like svelte you come across issues that more “battle tested” frameworks have solved already.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |