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 node_modules
data/* data/*
# have to add the bundle to version control so deployment with git subtree works dist/themes
# browser-bundle.js dist/semantic.min.css
browser-bundle.js
browser-bundle.js.map browser-bundle.js.map
npm-debug.log.* npm-debug.log.*

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

View File

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

View File

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

View File

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