Comments (5)
These options were removed in favor of ES6 or ES2015 (http://www.ecma-international.org/ecma-262/6.0/). The generator uses a gulp task and a library (babel-core) to transform (transpile) from ES6 to a Javascript that will be understood by most modern browsers (since not all of them are still up to speed with the latest ES6 features.)
You can still use Typescript, but you may have to change the gulp files, or play with the Typescript configuration. Typescript can generate both ES6 and plan JS, it all depends what your needs are. The trend I'm seeing now is to adopt and consume ES6, and use TypeScript as an add-on if you really want its static type-checking capabilities and language features not in ES6.
from generator-ko.
The problem I have now with this is the resulting code in the js file cannot be executed by the browser. startup.js for example generates:
import 'jquery';
import 'bootstrap';
import ko from 'knockout';
which immediately throws an error in Chrome (syntax error). Are there some new steps that have to be taken to get actual JavaScript generating in these js files so the browser can actually execute them?
from generator-ko.
This is ES6 code, not for direct browser consumption (for now) but to be pre-processed by "babel" (https://babeljs.io/) the gulpfile.js has a section (or task) called js:babel which converts (transpiles/compiles) from ES6 to browser-understendable JavaScript. ES6 is the future (or the present?) of JavaScript and most of modern libraries and tools use it extensively including generator-knockout.
In order for your startup.js to be "transpiled" you must serve your code from the "dist" folder, which is copied transpiled/bundled and minified by running gulp and then gulp serve:dist, or from the src folder which is dynamically transpiled by the "connect" server by running the the gulp serve:src task.
from generator-ko.
I use gulp serve:src
for development with this and have no issues.
from generator-ko.
As per @nenitiko's comments, this generator produces ES2015 only now (which is not TypeScript, BTW).
from generator-ko.
Related Issues (20)
- Out of the box: Uncaught Error: Script error for: knockout
- Out of the box: Typescript errors on Windows (aka. update TypeScript) HOT 1
- Grunt version of the gulp config HOT 1
- Multiple viewmodels per page HOT 2
- Gulp js task fails ("exceeds the max of 100KB") HOT 3
- Babel not works correctly HOT 8
- Components in ASP.NET 5 Projects HOT 1
- yeoman with knockout spits .js files with typescript content HOT 2
- 'js:babel' gulp task throws an error
- Why is the Typescript option removed? HOT 1
- Unexpected token import HOT 8
- serve:src looks for external js files in src/app folder HOT 1
- Out of the box: build fails on VS2015 - path too long
- Add a gulp watch for development
- Ditch bower
- Update to use npm
- create gulp task serve the ./dist folder HOT 5
- Deprecation warning for gulp-clean HOT 1
- JS Script Cache Invalidation HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generator-ko.