create prod version

This commit is contained in:
Adam Brown 2016-12-28 16:44:45 -05:00
parent 660c6e6b19
commit 0bc23bf5d3
6 changed files with 54 additions and 23088 deletions

5
.gitignore vendored
View File

@ -2,9 +2,10 @@
node_modules
data/*
# have to add the bundle to version control so deployment with git subtree works
# browser-bundle.js
dist/themes
dist/semantic.min.css
browser-bundle.js
browser-bundle.js.map
npm-debug.log.*

23098
dist/browser-bundle.js vendored

File diff suppressed because one or more lines are too long

View File

@ -5,9 +5,11 @@
"main": "src/server/babel.index.js",
"scripts": {
"copy-css": "cpy --parents --cwd=./node_modules/semantic-ui-css semantic.min.css themes/default/assets/fonts/icons.woff2 ../../dist",
"build": "npm run copy-css && webpack --colors",
"start": "npm run copy-css && webpack --progress --colors --watch",
"build": "npm run copy-css && webpack --progress --colors",
"build:prod": "npm run copy-css && cross-env NODE_ENV=production webpack -p --progress --colors",
"build:watch": "npm run copy-css && webpack --progress --colors --watch",
"serve": "node src/server/babel.index.js",
"serve:prod": "cross-env NODE_ENV=production node src/server/babel.index.js",
"webpack-stats": "webpack --json > stats.json",
"test": "mocha --watch --compilers js:babel-register"
},
@ -47,6 +49,7 @@
"babel-register": "^6.18.0",
"chai": "^3.5.0",
"copyfiles": "^0.2.2",
"cross-env": "^3.1.3",
"json-loader": "^0.5.4",
"mocha": "^3.2.0",
"piping": "^1.0.0-rc.4",

View File

@ -21,8 +21,6 @@ import LocalStorage from './LocalStorage'
//initial state is rehydrated from the server
const initialState = window.__INITIAL_STATE__
console.log('initialState', initialState)
//create the redux store
//initial state is retrieved from localStore
const store = Redux.createStore(

View File

@ -1,12 +1,12 @@
var Path = require('path');
var srcRoot = Path.join(__dirname, '..')//.replace(/\\/g, "/")
var srcRoot = Path.join(__dirname, '..')
//there should be some option for distribution / optimization?
var config = {
/* upgraded to babel 6 to be able to use this preset */
presets: ["node6", "react"],
sourceMaps: "both",
//enable source maps for non-production instances
sourceMaps: (process.env.NODE_ENV !== "production" ? "both" : false),
//highlightCode: false,
sourceRoot: srcRoot,
only: /src/
@ -15,16 +15,12 @@ var config = {
require('babel-core/register')(config);
const PIPING = true
//!!! Need to guard for production environments
//if (process.env.NODE_ENV !== "production") {
if (PIPING)
// Enable piping for non-production environments
if (process.env.NODE_ENV !== "production") {
if (!require("piping")({hook: true, includeModules: false})) {
return;
}
//}
}
try {
require('./index.js');

View File

@ -1,11 +1,10 @@
module.exports = {
let config = {
cache: true,
entry: './src/client/index.js',
output: {
filename: './dist/browser-bundle.js'
},
target: 'web',
// devtool: 'eval-module-source-map',
module: {
loaders: [
@ -26,3 +25,12 @@ module.exports = {
tls: 'empty'
}
};
if (process.env.NODE_ENV == "production") {
config.devtool = "cheap-module-source-map"
}
else {
config.devtool = "eval"
}
module.exports = config;