Skip to content

Commit ed89329

Browse files
committed
more webpack tests
1 parent 2d3456d commit ed89329

File tree

4 files changed

+34
-22
lines changed

4 files changed

+34
-22
lines changed

public/app/app.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ define([
55
'jquery',
66
'lodash',
77
'angular',
8-
'require',
98
'config',
109
'bootstrap',
1110
'angular-route',
@@ -16,7 +15,7 @@ define([
1615
'extend-jquery',
1716
'bindonce',
1817
],
19-
function ($, _, angular, appLevelRequire) {
18+
function ($, _, angular) {
2019

2120
"use strict";
2221

@@ -97,25 +96,25 @@ function ($, _, angular, appLevelRequire) {
9796
.element(document)
9897
.ready(function() {
9998
angular.bootstrap(document, apps_deps)
100-
.invoke(['$rootScope', function ($rootScope) {
99+
.invoke([function () {
101100
_.each(pre_boot_modules, function (module) {
102101
_.extend(module, register_fns);
103102
});
104103

105104
pre_boot_modules = false;
106-
$rootScope.requireContext = appLevelRequire;
107-
$rootScope.require = function (deps, fn) {
108-
var $scope = this;
109-
$scope.requireContext(deps, function () {
110-
var deps = _.toArray(arguments);
111-
// Check that this is a valid scope.
112-
if($scope.$id) {
113-
$scope.$apply(function () {
114-
fn.apply($scope, deps);
115-
});
116-
}
117-
});
118-
};
105+
// $rootScope.requireContext = appLevelRequire;
106+
// $rootScope.require = function (deps, fn) {
107+
// var $scope = this;
108+
// $scope.requireContext(deps, function () {
109+
// var deps = _.toArray(arguments);
110+
// // Check that this is a valid scope.
111+
// if($scope.$id) {
112+
// $scope.$apply(function () {
113+
// fn.apply($scope, deps);
114+
// });
115+
// }
116+
// });
117+
// };
119118
}]);
120119
});
121120
});

public/app/core/routes/module_loader.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
///<reference path="../../headers/require/require.d.ts" />
1+
2+
declare var require : any;
23

34
export class ModuleLoader {
45
lazy: any;
@@ -8,7 +9,8 @@ export class ModuleLoader {
89
this.lazy = ["$q", "$route", "$rootScope", function($q, $route, $rootScope) {
910
var defered = $q.defer();
1011

11-
require([moduleName], function () {
12+
require.ensure([], function () {
13+
require('../../features/org/all');
1214
defered.resolve();
1315
});
1416

public/views/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@
5555
</script>
5656

5757
<!-- build:js [[.AppSubUrl]]/app/app.js -->
58-
<script src="[[.AppSubUrl]]/public/app/bundle.js"></script>
58+
<script src="[[.AppSubUrl]]/public/app/bundle.app.js"></script>
5959
<!-- endbuild -->
6060

6161

62-
6362
[[if .GoogleAnalyticsId]]
6463
<script>
6564
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

webpack.config.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ var webpackConfig = {
1414
},
1515
output: {
1616
path: __dirname + '/public_gen/app/',
17-
filename: 'bundle.js',
18-
publicPath: 'app/'
17+
filename: 'bundle.[name].js',
18+
chunkFilename: "bundle.chunk.[name].[chunkhash].[id].js",
19+
sourceMapFilename: '[file].map',
20+
publicPath: 'app/',
1921
},
2022
plugins: [
2123
// This replaces shim stuff in RequireJS.
@@ -27,9 +29,18 @@ var webpackConfig = {
2729
],
2830
module: {
2931
unknownContextRegExp: /$^/,
32+
unknownContextCritical: true,
33+
34+
exprContextRegExp: /$^/,
35+
exprContextCritical: true,
36+
37+
wrappedContextRegExp: /$^/,
38+
wrappedContextCritical: true,
39+
3040
noParse: [
3141
/\.html/,
3242
/\.ts/,
43+
/\.d\.ts/,
3344
/\.map/,
3445
/cloudwatch/,
3546
/app\/panels/,
@@ -45,6 +56,7 @@ var webpackConfig = {
4556
]
4657
},
4758
resolve: {
59+
extenions: ['', '.js'],
4860
alias: {
4961
"kbn": absDir('/app/components/kbn.js'),
5062
"extend-jquery": absDir('/app/components/extend-jquery.js'),

0 commit comments

Comments
 (0)