Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Commit

Permalink
add webpack prof conf
Browse files Browse the repository at this point in the history
  • Loading branch information
criticalbh committed May 17, 2017
1 parent 94fc78a commit bd05e1a
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client/components/article.comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {X_Component} from "./component.dec";
// };

@X_Component({
templateUrl: 'client/components/article.comp.html',
templateUrl: 'components/article.comp.html',
model: {}
})
export class ArticleComponent extends HTMLElement {
Expand Down
3 changes: 2 additions & 1 deletion client/pages/home.comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {ArticleComponent} from "../components/article.comp";
"use strict";

@X_Component({
templateUrl: 'client/pages/home.comp.html'
templateUrl: 'pages/home.comp.html'
})
export class HomeComponent extends HTMLElement {
constructor() {
Expand All @@ -21,6 +21,7 @@ export class HomeComponent extends HTMLElement {

connectedCallback() {
HomeComponent.template({}).then(el => {

this.appendChild(el());

const globalFeed = document.getElementById('globalFeed');
Expand Down
21 changes: 21 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

var compression = require('compression');
var express = require('express');
var app = express();

// compress all requests
app.use(compression());

app.use(express.static(__dirname));

app.get('/*', function (req, res) {
res.sendFile(__dirname + '/index.html');
});

var server = app.listen(process.env.PORT || 8001, function () {
var host = server.address().address;
var port = server.address().port;

console.log('Listening at http://%s:%s', host, port);
});
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
"author": "<[email protected]>",
"license": "MIT",
"scripts": {
"start": "webpack-dev-server"
"start": "webpack-dev-server",
"build": "webpack --config webpack.config.prod.js",
"prod": "cp serve.js dist/serve.js && node serve.js"
},
"dependencies": {
"copy-webpack-plugin": "^4.0.1",
"html-webpack-plugin": "^2.28.0",
"path": "^0.12.7",
"webpack": "^2.5.1",
Expand Down
6 changes: 5 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
filename: 'index.html',
inject: 'body',
});
var CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
entry: ['./client/index.js'],
Expand All @@ -24,7 +25,10 @@ module.exports = {
{test: /\.jsx$/, loader: 'babel-loader', exclude: /node_modules/}
]
},
plugins: [HtmlWebpackPluginConfig, new webpack.HotModuleReplacementPlugin()],
plugins: [HtmlWebpackPluginConfig, new webpack.HotModuleReplacementPlugin(), new CopyWebpackPlugin([{
context: './client',
from: '**/*.html',
}])],
devServer: {
hot: true,
contentBase: './',
Expand Down
34 changes: 34 additions & 0 deletions webpack.config.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
devtool: 'source-map',
entry: ['./client/index.js'],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js'
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new HtmlWebpackPlugin({
template: './client/index.html'
}),

new CopyWebpackPlugin([{
context: './client',
from: '**/*.html',
}])
],
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {plugins: ['transform-decorators-legacy']}
}
]
}
}
81 changes: 74 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ babel-plugin-check-es2015-constants@^6.22.0:
dependencies:
babel-runtime "^6.22.0"

babel-plugin-syntax-decorators@^6.1.18:
version "6.13.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz#312563b4dbde3cc806cee3e416cceeaddd11ac0b"

babel-plugin-syntax-flow@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz#4c3ab20a2af26aa20cd25995c398c4eb70310c8d"
Expand All @@ -306,6 +310,14 @@ babel-plugin-syntax-jsx@^6.3.13, babel-plugin-syntax-jsx@^6.8.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"

babel-plugin-transform-decorators-legacy@^1.3.4:
version "1.3.4"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-decorators-legacy/-/babel-plugin-transform-decorators-legacy-1.3.4.tgz#741b58f6c5bce9e6027e0882d9c994f04f366925"
dependencies:
babel-plugin-syntax-decorators "^6.1.18"
babel-runtime "^6.2.0"
babel-template "^6.3.0"

babel-plugin-transform-es2015-arrow-functions@^6.22.0:
version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221"
Expand Down Expand Up @@ -580,14 +592,14 @@ babel-register@^6.24.1:
mkdirp "^0.5.1"
source-map-support "^0.4.2"

babel-runtime@^6.18.0, babel-runtime@^6.22.0:
babel-runtime@^6.18.0, babel-runtime@^6.2.0, babel-runtime@^6.22.0:
version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b"
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.10.0"

babel-template@^6.24.1:
babel-template@^6.24.1, babel-template@^6.3.0:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.24.1.tgz#04ae514f1f93b3a2537f2a0f60a5a45fb8308333"
dependencies:
Expand Down Expand Up @@ -656,6 +668,10 @@ block-stream@*:
dependencies:
inherits "~2.0.0"

bluebird@^2.10.2:
version "2.11.0"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1"

bluebird@^3.4.7:
version "3.5.0"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c"
Expand Down Expand Up @@ -934,6 +950,19 @@ [email protected]:
version "0.3.1"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"

copy-webpack-plugin@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-4.0.1.tgz#9728e383b94316050d0c7463958f2b85c0aa8200"
dependencies:
bluebird "^2.10.2"
fs-extra "^0.26.4"
glob "^6.0.4"
is-glob "^3.1.0"
loader-utils "^0.2.15"
lodash "^4.3.0"
minimatch "^3.0.0"
node-dir "^0.1.10"

core-js@^2.4.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e"
Expand Down Expand Up @@ -1353,6 +1382,16 @@ [email protected]:
version "0.5.0"
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.0.tgz#f474ca5e6a9246d6fd8e0953cfa9b9c805afa78e"

fs-extra@^0.26.4:
version "0.26.7"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.26.7.tgz#9ae1fdd94897798edab76d0918cf42d0c3184fa9"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^2.1.0"
klaw "^1.0.0"
path-is-absolute "^1.0.0"
rimraf "^2.2.8"

fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
Expand Down Expand Up @@ -1417,6 +1456,16 @@ glob-parent@^2.0.0:
dependencies:
is-glob "^2.0.0"

glob@^6.0.4:
version "6.0.4"
resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22"
dependencies:
inflight "^1.0.4"
inherits "2"
minimatch "2 || 3"
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^7.0.5:
version "7.1.1"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
Expand All @@ -1432,7 +1481,7 @@ globals@^9.0.0:
version "9.17.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-9.17.0.tgz#0c0ca696d9b9bb694d2e5470bd37777caad50286"

graceful-fs@^4.1.2:
graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"

Expand Down Expand Up @@ -1811,6 +1860,12 @@ json5@^0.5.0, json5@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"

jsonfile@^2.1.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8"
optionalDependencies:
graceful-fs "^4.1.6"

jsonify@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
Expand All @@ -1830,6 +1885,12 @@ kind-of@^3.0.2:
dependencies:
is-buffer "^1.1.5"

klaw@^1.0.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439"
optionalDependencies:
graceful-fs "^4.1.9"

lazy-cache@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"
Expand All @@ -1854,7 +1915,7 @@ loader-runner@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2"

loader-utils@^0.2.16:
loader-utils@^0.2.15, loader-utils@^0.2.16:
version "0.2.17"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348"
dependencies:
Expand All @@ -1871,7 +1932,7 @@ loader-utils@^1.0.2:
emojis-list "^2.0.0"
json5 "^0.5.0"

lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.2.0:
lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.2.0, lodash@^4.3.0:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"

Expand Down Expand Up @@ -1963,7 +2024,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"

minimatch@^3.0.0, minimatch@^3.0.2:
"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
dependencies:
Expand Down Expand Up @@ -2015,6 +2076,12 @@ no-case@^2.2.0:
dependencies:
lower-case "^1.1.1"

node-dir@^0.1.10:
version "0.1.16"
resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.16.tgz#d2ef583aa50b90d93db8cdd26fcea58353957fe4"
dependencies:
minimatch "^3.0.2"

node-libs-browser@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.0.0.tgz#a3a59ec97024985b46e958379646f96c4b616646"
Expand Down Expand Up @@ -2544,7 +2611,7 @@ right-align@^0.1.1:
dependencies:
align-text "^0.1.1"

rimraf@2, rimraf@^2.5.1, rimraf@^2.6.1:
rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d"
dependencies:
Expand Down

0 comments on commit bd05e1a

Please sign in to comment.