├── .gitignore
├── E2E
├── HomeE2E.js
└── protractor-conf.js
├── LICENSE
├── README.md
├── app
├── app.Spec.js
├── app.js
├── index.html
├── intface
│ └── nav.html
├── page
│ ├── about
│ │ ├── about.html
│ │ ├── about.js
│ │ └── about.styl
│ ├── home
│ │ ├── home.html
│ │ ├── home.js
│ │ └── home.styl
│ └── page.js
├── rev-manifest.json
└── widgets
│ └── navbar
│ ├── navbar.Spec.js
│ ├── navbar.ctrl.js
│ ├── navbar.html
│ ├── navbar.js
│ └── navbar.styl
├── gulp
├── config.js
└── task
│ ├── clean.js
│ ├── debug_html.js
│ ├── html.js
│ ├── rebuild.js
│ ├── test.js
│ ├── watch.js
│ └── webpack.js
├── gulpfile.js
├── karma.conf.js
├── package.json
├── webpack.config.js
└── webpack.dev.js
/.gitignore:
--------------------------------------------------------------------------------
1 | /.idea
2 | /node_modules
3 | /bin
4 | /coverage
5 |
--------------------------------------------------------------------------------
/E2E/HomeE2E.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var chai = require('chai');
4 | var chaiAsPromised = require('chai-as-promised');
5 | chai.use(chaiAsPromised);
6 | var expect = chai.expect;
7 |
8 | describe('HomeE2E', function() {
9 | beforeEach(function() {
10 | browser.get('/');
11 | });
12 |
13 | it('测试LINKS', function() {
14 | var todoList = element.all(by.repeater('x in links'));
15 | expect(todoList.get(1).getText()).to.eventually.equal('about');
16 | expect(todoList.get(0).getText()).to.eventually.equal('home');
17 | });
18 |
19 | it('测试输入框', function() {
20 | var HomeInput = element(by.model('HomeInput'));
21 | var Hometext = element(by.id('Hometext'));
22 | HomeInput.sendKeys('nexus');
23 | expect(Hometext.getText()).to.eventually.equal('nexus');
24 | HomeInput.clear();
25 | });
26 | });
27 |
28 |
--------------------------------------------------------------------------------
/E2E/protractor-conf.js:
--------------------------------------------------------------------------------
1 | exports.config = {
2 | allScriptsTimeout: 10000,
3 |
4 | specs: [
5 | '*.js'
6 | ],
7 |
8 | capabilities: {
9 | 'browserName': 'chrome'
10 | },
11 |
12 | chromeOnly: true,
13 | baseUrl: 'http://localhost:3000/',
14 | framework: 'mocha',
15 | mochaOpts: {
16 | timeout: 10000
17 | }
18 | };
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # zchq88_seed
2 |
3 |
4 |
5 |
6 |
7 |
8 | > 这个项目使用 [Angular1.x](https://angularjs.org), [ES6](https://git.io/es6features),[Webpack](http://webpack.github.io/)
9 |
10 | 这是一个简单的例子来构建一个用[Angular1.x](https://angularjs.org), [ES6](https://git.io/es6features),[Webpack](http://webpack.github.io/)的项目.
11 |
12 | # 目录
13 | * [项目编译](# 项目编译)
14 | * [项目测试](# 项目测试)
15 | * [如何使用](# 如何使用)
16 |
17 | ## 项目编译
18 | *使用了`Babel`
19 | *使用了`webpack`
20 | *使用了`Stylus`
21 | ## 项目测试
22 | *使用了`karma`
23 | *使用了`mocha`
24 | *使用了`chai`
25 | *使用了`protractor`
26 | ## 如何使用
27 | *npm install -g gulp karma karma-cli webpack protractor全局安装
28 | *npm install 安装所有插件
29 | *test 单元测试
30 | *debug_server 启动测试html服务 localhost:3000
31 | *webpack-dev-server 启动测试webpack服务 localhost:3003
32 | *E2Etest 网页测试
33 | *Prod_bulid 生成项目到BIN文件夹
34 |
--------------------------------------------------------------------------------
/app/app.Spec.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file 测试app
3 | * @author zchq88
4 | */
5 | import angular from 'angular';
6 | import mocks from 'angular-mocks';
--------------------------------------------------------------------------------
/app/app.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file 入口JS
3 | * @author zchq88
4 | */
5 |
6 | import page from './page/page';
7 |
8 | var App = angular.module('App', [
9 | page.name
10 | ]);
11 |
--------------------------------------------------------------------------------
/app/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | zchq88_seed
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/intface/nav.html:
--------------------------------------------------------------------------------
1 | ["home", "about"]
--------------------------------------------------------------------------------
/app/page/about/about.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
about
4 |
5 |
--------------------------------------------------------------------------------
/app/page/about/about.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file about.js
3 | * @author zchq88
4 | */
5 |
6 | import './about.styl';
7 | import navbar from '../../widgets/navbar/navbar';
8 |
9 | let aboutModule = angular.module('about', [
10 | 'ui.router',
11 | navbar.name
12 | ])
13 | .config(($stateProvider) => {
14 | $stateProvider
15 | .state('about', {
16 | url: '/about',
17 | views: {
18 | app: {
19 | templateUrl: 'page/about/about.html'
20 | }
21 | }
22 | });
23 | });
24 |
25 | export default aboutModule;
26 |
--------------------------------------------------------------------------------
/app/page/about/about.styl:
--------------------------------------------------------------------------------
1 | .about
2 | color #ff0c11
3 |
--------------------------------------------------------------------------------
/app/page/home/home.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
home
4 |
5 |
--------------------------------------------------------------------------------
/app/page/home/home.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file home.js
3 | * @author zchq88
4 | */
5 |
6 | import './home.styl';
7 | import navbar from '../../widgets/navbar/navbar';
8 |
9 | let homeModule = angular.module('home', [
10 | 'ui.router',
11 | navbar.name
12 | ])
13 | .config(($stateProvider, $urlRouterProvider) => {
14 | $urlRouterProvider.otherwise('/');
15 | $stateProvider
16 | .state('home', {
17 | url: '/',
18 | views: {
19 | app: {
20 | templateUrl: 'page/home/home.html'
21 | }
22 | }
23 | });
24 | });
25 |
26 | export default homeModule;
27 |
--------------------------------------------------------------------------------
/app/page/home/home.styl:
--------------------------------------------------------------------------------
1 | .home
2 | color #ff7255
3 |
--------------------------------------------------------------------------------
/app/page/page.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file 页面入口
3 | * @author zchq88
4 | */
5 | import Home from './home/home';
6 | import About from './about/about';
7 |
8 | let page = angular.module('app.page', [
9 | Home.name,
10 | About.name
11 | ]);
12 | export default page;
13 |
--------------------------------------------------------------------------------
/app/rev-manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "app.js": "http://localhost:3003/app.js"
3 | }
--------------------------------------------------------------------------------
/app/widgets/navbar/navbar.Spec.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file 测试navbar控制器
3 | * @author zchq88
4 | */
5 | import navbar from './navbar.ctrl.js';
6 |
7 | describe('navbar', function () {
8 | let scope;
9 | beforeEach(angular.mock.module('navbar'));
10 | beforeEach(angular.mock.inject(function ($rootScope, $controller) {
11 | scope = $rootScope.$new();
12 | $controller('navbarCtrl', {$scope: scope});
13 | }));
14 | it('Controller测试', function () {
15 | expect(scope).to.have.property('links').with.length(2);
16 | });
17 | });
--------------------------------------------------------------------------------
/app/widgets/navbar/navbar.ctrl.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file navbar控制器
3 | * @author zchq88
4 | */
5 |
6 | let navbar = angular.module('navbar', []);
7 | navbar.controller('navbarCtrl', function ($scope/*,$http*/) {
8 | //$http.get('intface/nav.html')
9 | // .success(function(response) {
10 | // $scope.links = response;
11 | // });
12 | $scope.links = ['home', 'about'];
13 | });
14 |
15 | module.exports = navbar;
16 | //export default navbar;//ES6单元测试试有问题所以改用了module.exports = navbar;写法
17 |
--------------------------------------------------------------------------------
/app/widgets/navbar/navbar.html:
--------------------------------------------------------------------------------
1 |
32 |
--------------------------------------------------------------------------------
/app/widgets/navbar/navbar.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file navbar
3 | * @author zchq88
4 | */
5 | import './navbar.styl';
6 | import navbar from './navbar.ctrl.js'
7 |
8 | navbar.directive('navbar', function () {
9 | return {
10 | restrict: 'AE',
11 | templateUrl: '/widgets/navbar/navbar.html'
12 | };
13 | });
14 |
15 | export default navbar;
--------------------------------------------------------------------------------
/app/widgets/navbar/navbar.styl:
--------------------------------------------------------------------------------
1 | navbar
2 | font-size large
--------------------------------------------------------------------------------
/gulp/config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file gulp配置
3 | * @author zchq88
4 | */
5 | var VERSION = require('../package.json').version;
6 | var serve = require('browser-sync');
7 | var path = require('path');
8 | var root = 'app';
9 |
10 | function resolveToApp(files) {
11 | return path.join(root, files);
12 | }
13 | module.exports = {
14 | banner: '/*!\n'
15 | + ' * zchq88_seed\n'
16 | + ' * @license MIT\n'
17 | + ' * v' + VERSION + '\n'
18 | + ' */\n',
19 | output: 'bin',
20 | debug: 'debug',
21 | entry: 'app/app.js',
22 | root: root,
23 | paths: {
24 | js: resolveToApp('/**/*!(.spec.js).js'),
25 | html: [
26 | resolveToApp('**/*.html')
27 | ],
28 | styl: resolveToApp('**/*.styl')
29 | },
30 | serve: serve
31 | };
32 |
--------------------------------------------------------------------------------
/gulp/task/clean.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file gulp任务test
3 | * @author zchq88
4 | */
5 |
6 | var gulp = require('gulp');
7 | var clean = require('gulp-clean');
8 | var config = require('../config');// gulp公共配置
9 |
10 | exports.task = function () {
11 | return gulp.src([config.output, config.debug])
12 | .pipe(clean({force: true}))
13 | };
14 |
--------------------------------------------------------------------------------
/gulp/task/debug_html.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file gulp任务 调试模式
3 | * @author zchq88
4 | */
5 |
6 | var gulp = require('gulp');
7 | var config = require('../config');// gulp公共配置
8 | var revCollector = require('gulp-rev-collector'); //- 路径替换
9 |
10 | exports.task = function () {
11 | var path = config.paths.html.concat('app/rev-manifest.json');
12 | return gulp.src(path)
13 | .pipe(revCollector())
14 | .pipe(gulp.dest(config.debug))
15 | };
16 |
--------------------------------------------------------------------------------
/gulp/task/html.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file gulp任务 监听任务
3 | * @author zchq88
4 | */
5 |
6 | var gulp = require('gulp');
7 | var config = require('../config');// gulp公共配置
8 |
9 | exports.task = function () {
10 | return gulp.src(config.paths.html)
11 | .pipe(gulp.dest(config.output))
12 |
13 | };
14 |
--------------------------------------------------------------------------------
/gulp/task/rebuild.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file gulp任务rebuild.js
3 | * @author zchq88
4 | */
5 |
6 | exports.dependencies = ['webpack', 'html'];
7 | var gulp = require('gulp');
8 | var config = require('../config');// gulp公共配置
9 | var revCollector = require('gulp-rev-collector'); //- 路径替换
10 | var minifyHtml = require("gulp-minify-html"); //html压缩
11 |
12 | exports.task = function () {
13 | return gulp.src([config.output + '/rev/**/*.json', config.output + '/**/*.html'])
14 | .pipe(revCollector())
15 | .pipe(minifyHtml())
16 | .pipe(gulp.dest(config.output))
17 | };
--------------------------------------------------------------------------------
/gulp/task/test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file gulp任务test
3 | * @author zchq88
4 | */
5 |
6 | var gutil = require('gulp-util');
7 | var config = require('../config');// gulp公共配置
8 |
9 | exports.task = function () {
10 | gutil.log(gutil.colors.red(config.banner));
11 | };
12 |
--------------------------------------------------------------------------------
/gulp/task/watch.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file gulp任务 监听任务
3 | * @author zchq88
4 | */
5 |
6 | var gulp = require('gulp');
7 | var gutil = require('gulp-util');
8 | var config = require('../config');// gulp公共配置
9 | var path = require('path');
10 |
11 | exports.dependencies = ['debug_html'];
12 | exports.task = function () {
13 | config.serve({
14 | port: process.env.PORT || 3000,
15 | open: false,
16 | server: {baseDir: config.debug}
17 | });
18 | gutil.log(gutil.colors.red('server启动'));
19 | var reload = function () {
20 | return config.serve.reload();
21 | };
22 | gulp.watch(config.paths.html, ['debug_html', reload]);
23 | };
24 |
--------------------------------------------------------------------------------
/gulp/task/webpack.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file gulp任务webpack
3 | * @author zchq88
4 | */
5 |
6 | var webpack = require('webpack-stream');
7 | var gulp = require('gulp');
8 | var gutil = require('gulp-util');
9 | var uglify = require('gulp-uglify');
10 | var config = require('../config');// gulp公共配置
11 | var plumber = require('gulp-plumber');// 报错不退出
12 | var rev = require('gulp-rev'); //- 对文件名加MD5后缀
13 |
14 | exports.task = function () {
15 | gutil.log(gutil.colors.red(config.entry));
16 | return gulp.src(config.entry)
17 | .pipe(plumber())
18 | .pipe(webpack(require('../../webpack.config')))
19 | .pipe(uglify())
20 | .pipe(rev())
21 | .pipe(gulp.dest(config.output))
22 | .pipe(rev.manifest())
23 | .pipe(gulp.dest(config.output + '/rev/js'))
24 | };
25 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file gulp任务分拣
3 | * @author zchq88
4 | */
5 |
6 | 'use strict';
7 |
8 | var gulp = require('gulp');
9 | var gutil = require('gulp-util');
10 | var fs = require('fs');
11 | var runSequence = require('gulp-run-sequence');
12 |
13 | // 任务入口
14 | gulp.task('default', ['clean'], function () {
15 | var log = gutil.colors.red('启动完成');
16 | gutil.log(gutil.colors.bgBlack(log));
17 | runSequence('rebuild');
18 | });
19 |
20 | // 从gulp目录读取任务
21 | fs.readdirSync('./gulp/task')
22 | .filter(function (filename) {
23 | return filename.match(/\.js$/i);
24 | })
25 | .map(function (filename) {
26 | return {
27 | name: filename.substr(0, filename.length - 3),
28 | contents: require('./gulp/task/' + filename)
29 | };
30 | })
31 | .forEach(function (file) {
32 | gulp.task(file.name, file.contents.dependencies, file.contents.task);
33 | });
34 |
--------------------------------------------------------------------------------
/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration
2 | // Generated on Mon Jan 04 2016 10:17:13 GMT+0800 (中国标准时间)
3 |
4 | module.exports = function (config) {
5 | config.set({
6 |
7 | // base path that will be used to resolve all patterns (eg. files, exclude)
8 | basePath: '',
9 |
10 |
11 | // frameworks to use
12 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13 | frameworks: ['mocha', 'chai'],
14 |
15 |
16 | // list of files / patterns to load in the browser
17 | files: ['app/**/*Spec.js'],
18 |
19 |
20 | // list of files to exclude
21 | exclude: [],
22 |
23 |
24 | // preprocess matching files before serving them to the browser
25 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
26 | preprocessors: {
27 | 'app/**/*Spec.js': ['webpack', 'sourcemap'],
28 | 'app/**/*(!Spec).js': ['webpack', 'sourcemap', 'coverage']
29 | },
30 |
31 |
32 | // test results reporter to use
33 | // possible values: 'dots', 'progress'
34 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter
35 | reporters: ['mocha', 'coverage'],
36 | coverageReporter: {
37 | reporters: [
38 | {type: 'text-summary'},
39 | {type: 'html', dir: 'coverage/'}
40 | ]
41 | },
42 |
43 |
44 | // web server port
45 | port: 9876,
46 |
47 |
48 | // enable / disable colors in the output (reporters and logs)
49 | colors: true,
50 |
51 |
52 | // level of logging
53 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
54 | logLevel: config.LOG_INFO,
55 |
56 |
57 | // enable / disable watching file and executing tests whenever any file changes
58 | autoWatch: false,
59 |
60 |
61 | // start these browsers
62 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
63 | browsers: ['Chrome'],
64 |
65 |
66 | // Continuous Integration mode
67 | // if true, Karma captures browsers, runs the tests and exits
68 | singleRun: true,
69 |
70 | // Concurrency level
71 | // how many browser should be started simultaneous
72 | concurrency: Infinity,
73 |
74 | webpack: {
75 | devtool: 'inline-source-map',
76 | module: {
77 | preLoaders: [{
78 | test: /\.js$/,
79 | exclude: [/node_modules/,/\.Spec.js$/],
80 | loader: 'isparta-instrumenter'
81 | }],
82 | loaders: [
83 | {test: /\.js$/, exclude: [/node_modules/], loader: 'ng-annotate!babel'},
84 | {test: /\.html/, loader: 'raw'},
85 | {test: /\.styl$/, loader: 'style!css!stylus'},
86 | {test: /\.css$/, loader: 'style!css'}
87 | ]
88 | }
89 | },
90 | webpackServer: {
91 | noInfo: true // prevent console spamming when running in Karma!
92 | },
93 | plugins: [
94 | 'karma-chrome-launcher',
95 | 'karma-chai',
96 | 'karma-mocha',
97 | 'karma-webpack',
98 | 'karma-sourcemap-loader',
99 | 'karma-coverage',
100 | 'karma-mocha-reporter'
101 | ]
102 | })
103 | };
104 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "zchq88_seed",
3 | "version": "0.0.1",
4 | "description": "seed for Angular + ES6 + Webpack",
5 | "dependencies": {
6 | "angular": "^1.4.8",
7 | "angular-mocks": "^1.4.8",
8 | "babel-core": "^5.8.34",
9 | "babel-loader": "^5.4.0",
10 | "browser-sync": "^2.10.1",
11 | "chai": "^3.4.1",
12 | "chai-as-promised": "^5.2.0",
13 | "css-loader": "^0.23.1",
14 | "findup-sync": "^0.4.0",
15 | "gulp": "^3.9.0",
16 | "gulp-clean": "^0.3.1",
17 | "gulp-minify-html": "^1.0.6",
18 | "gulp-plumber": "^1.0.1",
19 | "gulp-rev": "^7.0.0",
20 | "gulp-rev-collector": "^1.0.3",
21 | "gulp-run-sequence": "^0.3.2",
22 | "gulp-uglify": "^1.5.1",
23 | "gulp-util": "^3.0.7",
24 | "isparta": "^4.0.0",
25 | "isparta-instrumenter-loader": "^1.0.0",
26 | "istanbul": "^0.4.1",
27 | "karma": "^0.13.16",
28 | "karma-chai": "^0.1.0",
29 | "karma-chrome-launcher": "^0.2.2",
30 | "karma-coverage": "^0.5.3",
31 | "karma-mocha": "^0.2.1",
32 | "karma-mocha-reporter": "^1.1.5",
33 | "karma-sourcemap-loader": "^0.3.6",
34 | "karma-webpack": "^1.7.0",
35 | "mocha": "^2.3.4",
36 | "ng-annotate-loader": "0.0.10",
37 | "protractor": "^3.0.0",
38 | "raw-loader": "^0.5.1",
39 | "run-sequence": "^1.1.5",
40 | "style-loader": "^0.13.0",
41 | "stylus-loader": "^1.4.2",
42 | "vinyl-fs": "^0.3.0",
43 | "webpack": "^1.12.9",
44 | "webpack-stream": "^3.1.0"
45 | },
46 | "devDependencies": {
47 | "karma-chrome-launcher": "^0.2.3"
48 | },
49 | "scripts": {
50 | "test": "karma start",
51 | "webpack-dev-server": "webpack-dev-server --config webpack.dev.js --inline --progress --profile --colors --watch --display-error-details --display-cached --content-base src/ --hot",
52 | "preE2Etest": "webdriver-manager update",
53 | "E2Etest": "protractor E2E/protractor-conf.js",
54 | "preProd_bulid": "gulp clean",
55 | "debug_server": "gulp watch",
56 | "Prod_bulid": "gulp rebuild"
57 | },
58 | "keywords": [
59 | "angular",
60 | "webpack",
61 | "es6"
62 | ],
63 | "repository": {
64 | "type": "git",
65 | "url": "https://github.com/zchq88/zchq88_seed.git"
66 | },
67 | "license": "MIT"
68 | }
69 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file webpack配置
3 | * @author zchq88
4 | */
5 | module.exports = {
6 | devtool: 'false',
7 | entry: './app/app.js',
8 | output: {
9 | filename: 'app.js'
10 | },
11 | module: {
12 | loaders: [
13 | {test: /\.js$/, exclude: [/app\/lib/, /node_modules/], loader: 'ng-annotate!babel'},
14 | {test: /\.html$/, loader: 'raw'},
15 | {test: /\.styl$/, loader: 'style!css!stylus'},
16 | {test: /\.css$/, loader: 'style!css'}
17 | ]
18 | }
19 | };
20 |
--------------------------------------------------------------------------------
/webpack.dev.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @file webpack配置
3 | * @author zchq88
4 | */
5 |
6 | module.exports = {
7 | debug: true,
8 | devtool: 'cheap-module-source-map',
9 | entry: './app/app.js',
10 | output: {
11 | filename: 'app.js'
12 | },
13 | module: {
14 | loaders: [
15 | {test: /\.js$/, exclude: [/app\/lib/, /node_modules/], loader: 'ng-annotate!babel'},
16 | {test: /\.html$/, loader: 'raw'},
17 | {test: /\.styl$/, loader: 'style!css!stylus'},
18 | {test: /\.css$/, loader: 'style!css'}
19 | ]
20 | },
21 | devServer: {
22 | port: 3003,
23 | host: 'localhost',
24 | watchOptions: {
25 | aggregateTimeout: 300,
26 | poll: 1000
27 | }
28 | },
29 | node: {
30 | global: 'window',
31 | crypto: 'empty',
32 | process: true,
33 | module: false,
34 | clearImmediate: false,
35 | setImmediate: false
36 | }
37 | };
38 |
--------------------------------------------------------------------------------