Skip to content

Commit 31d6d7a

Browse files
committed
Removed code that was originally being inlined for dev server that now doesn't need to be inlined. Now ng serve should just _work_ for mobile builds and caching should also work correctly
1 parent a59eed3 commit 31d6d7a

File tree

2 files changed

+17
-32
lines changed

2 files changed

+17
-32
lines changed

addon/ng2/models/webpack-build-production.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const getWebpackProdConfigPartial = function(projectRoot: string) {
1818
},
1919
plugins: [
2020
new WebpackMd5Hash(),
21-
new webpack.optimize.DedupePlugin(),
21+
new webpack.optimize.DedupePlugin()
2222
// ~400kb (Doesn't do anything different (yet?))
2323
// new LoaderOptionsPlugin({
2424
// test: /\.js/,
@@ -27,19 +27,19 @@ export const getWebpackProdConfigPartial = function(projectRoot: string) {
2727
// debug: false
2828
// }),
2929
// ~107kb
30-
new webpack.optimize.UglifyJsPlugin({
31-
beautify: false, //prod
32-
mangle: { screw_ie8 : true }, //prod
33-
compress: { screw_ie8: true }, //prod
34-
comments: false //prod
35-
}),
36-
new CompressionPlugin({
37-
asset: "[path].gz[query]",
38-
algorithm: "gzip",
39-
test: /\.js$|\.html$/,
40-
threshold: 10240,
41-
minRatio: 0.8
42-
})
30+
// new webpack.optimize.UglifyJsPlugin({
31+
// beautify: false, //prod
32+
// mangle: { screw_ie8 : true }, //prod
33+
// compress: { screw_ie8: true }, //prod
34+
// comments: false //prod
35+
// }),
36+
// new CompressionPlugin({
37+
// asset: "[path].gz[query]",
38+
// algorithm: "gzip",
39+
// test: /\.js$|\.html$/,
40+
// threshold: 10240,
41+
// minRatio: 0.8
42+
// })
4343
],
4444
tslint: {
4545
emitErrors: true,

addon/ng2/tasks/serve-webpack.ts

+3-18
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,8 @@ module.exports = Task.extend({
1919
run: function(commandOptions: ServeTaskOptions) {
2020

2121
let webpackCompiler: any;
22-
// if (commandOptions.environment === 'material') {
23-
// webpackDevMaterialConfig.entry.main.unshift(`webpack-dev-server/client?http://localhost:${commandOptions.port}/`);
24-
// webpackCompiler = webpack(webpackDevMaterialConfig);
25-
26-
// } else if (commandOptions.environment === 'e2e') {
27-
// webpackDevMaterialE2EConfig.entry.main.unshift(`webpack-dev-server/client?http://localhost:${commandOptions.port}/`);
28-
// webpackCompiler = webpack(webpackDevMaterialE2EConfig);
29-
30-
// } else {
31-
// webpackDevConfig.entry.main.unshift(`webpack-dev-server/client?http://localhost:${commandOptions.port}/`);
32-
// webpackCompiler = webpack(webpackDevConfig);
33-
// }
34-
35-
// since the .config method on the returned instance is just an object we can modify any part of it for our needs
36-
var config = new NgCliWebpackConfig(this.project, commandOptions.environment).config;
37-
config.entry.main.unshift(`webpack-dev-server/client?http://localhost:${commandOptions.port}/`);
22+
23+
var config: NgCliWebpackConfig = new NgCliWebpackConfig(this.project, commandOptions.environment).config;
3824
webpackCompiler = webpack(config);
3925

4026

@@ -44,7 +30,7 @@ module.exports = Task.extend({
4430
}));
4531

4632
const webpackDevServerConfiguration: IWebpackDevServerConfigurationOptions = {
47-
contentBase: path.resolve(process.cwd(), './src'),
33+
contentBase: path.resolve(this.project.root, './src'),
4834
historyApiFallback: true,
4935
stats: webpackDevServerOutputOptions,
5036
inline: true
@@ -54,7 +40,6 @@ module.exports = Task.extend({
5440
const server = new WebpackDevServer(webpackCompiler, webpackDevServerConfiguration);
5541

5642
return new Promise((resolve, reject) => {
57-
process.stdout.write(chalk.red('\n\n' + chalk.underline.bgYellow('TODO#'), 'Implement ENV Flags for serve builds.\n\n'));
5843
server.listen(commandOptions.port, "localhost", function(err, stats) {
5944
if(err) {
6045
lastHash = null;

0 commit comments

Comments
 (0)