├── .gitignore ├── readme.MD ├── jsconfig.json ├── src └── app │ ├── example-component │ ├── example-controller │ │ └── example-controller.js │ ├── example-service │ │ └── example-service.js │ ├── example.js │ └── example-directive │ │ └── example-directive.js │ └── app.js ├── webpack.config.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /readme.MD: -------------------------------------------------------------------------------- 1 | npm install 2 | 3 | npm run build -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES6", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /src/app/example-component/example-controller/example-controller.js: -------------------------------------------------------------------------------- 1 | export default class ExampleController { 2 | constructor() { 3 | this.controllerName = 'Example Controller'; 4 | } 5 | } -------------------------------------------------------------------------------- /src/app/app.js: -------------------------------------------------------------------------------- 1 | import angular from 'angular'; 2 | import example from './example-component/example.js' 3 | 4 | angular.module('app', [ 5 | 'example' 6 | ]); 7 | 8 | angular.bootstrap(document, ['app']); -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | 3 | module.exports = { 4 | entry: path.resolve(__dirname, 'src/app/app.js'), 5 | output: { 6 | path: path.resolve(__dirname, 'build'), 7 | filename: 'bundle.js' 8 | }, 9 | module: { 10 | loaders: [{ 11 | test: /\.js$/, 12 | loader: 'babel' 13 | }] 14 | } 15 | }; -------------------------------------------------------------------------------- /src/app/example-component/example-service/example-service.js: -------------------------------------------------------------------------------- 1 | export default class ExampleService { 2 | constructor($http) { 3 | this.$http = $http; 4 | } 5 | 6 | // Example service function 7 | getData () { 8 | return this.$http({method: 'GET', url: './api' }); 9 | } 10 | } 11 | 12 | ExampleService.$inject = ['$http']; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webpack-angular-es6", 3 | "version": "1.0.0", 4 | "description": "Webpack Angular Test", 5 | "scripts": { 6 | "build": "webpack" 7 | }, 8 | "author": "David den Toom", 9 | "license": "ISC", 10 | "devDependencies": { 11 | "babel-core": "^5.8.33", 12 | "babel-loader": "^5.3.3", 13 | "webpack": "^1.12.2" 14 | }, 15 | "dependencies": { 16 | "angular": "^1.4.7" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/app/example-component/example.js: -------------------------------------------------------------------------------- 1 | import angular from 'angular'; 2 | 3 | import ExampleController from './example-controller/example-controller.js'; 4 | import ExampleDirective from './example-directive/example-directive.js'; 5 | import ExampleService from './example-service/example-service.js'; 6 | 7 | export default angular.module('example', []) 8 | .controller('exampleController', ExampleController) 9 | .service('exampleService', ExampleService) 10 | .directive('exampleDirective', () => new ExampleDirective); -------------------------------------------------------------------------------- /src/app/example-component/example-directive/example-directive.js: -------------------------------------------------------------------------------- 1 | export default class ExampleDirective { 2 | constructor() { 3 | this.template = '