Menu
  • HOME
  • TAGS

Initialization order for ES6 imports and angular controllers

javascript,angularjs,ecmascript-6,es6-module-loader

ES6 imports are hoisted to the top of the file, so you cannot rely on ordering like this. The core of the issue for you is that you're relying on a implicit dependency (app) that isn't defined anywhere. Explicitly importing app would ensure that you actually get things in order....

Use requirejs modules as es6 module

javascript,requirejs,ecmascript-6,commonjs,es6-module-loader

SystemJS can load es6 modules and AMD or CommonJS together. It has format detector, so you can just import module via System.import, and then library takes care about module formats...

Can I use an ES6/2015 module import to set a reference in 'global' scope?

javascript,ecmascript-6,webpack,es6-module-loader

Shimming modules is the way to go: http://webpack.github.io/docs/shimming-modules.html I quote from the page: plugin ProvidePlugin This plugin makes a module available as variable in every module. The module is required only if you use the variable. Example: Make $ and jQuery available in every module without writing require("jquery"). new webpack.ProvidePlugin({...

Angular 1.x, ES5/ES6 and testing with Karma

javascript,angularjs,karma-runner,es6-module-loader

The solution I ended up finding involved using karma-systemjs. Include all your tests files on the systemjs/files section: systemjs: { files: [ // TEST FILES ], configFile: 'system.config.js', config: { paths: { 'angular-mocks': 'node_modules/angular-mocks/angular-mocks.js' } } } And on the tests instead of using: System.import('boot'); Use: 'use strict'; import 'angular-mocks';...