Permalink
Browse files

build demo

  • Loading branch information...
mariusandra committed Dec 16, 2016
1 parent 4801749 commit 147e4909c21738537493009f605490b8ffaa48d3
Showing with 69 additions and 15 deletions.
  1. +24 −0 build.js
  2. +1 −1 demo/index.html
  3. +11 −0 index.html
  4. +1 −0 package.json
  5. +5 −0 static/demo-bundle.js
  6. +11 −0 static/index.html
  7. +16 −14 webpack.config.js
View
@@ -0,0 +1,24 @@
/* eslint no-var: 0 */
var exec = require('child_process').exec;
var cmdLine = './node_modules/.bin/webpack --progress';
var environ = (!process.argv[2].indexOf('development')) ? 'development' : 'production';
var command;
if (process.platform === 'win32') {
cmdLine = 'set NODE_ENV=' + environ + '&& ' + cmdLine;
} else {
cmdLine = 'NODE_ENV=' + environ + ' ' + cmdLine;
}
command = exec(cmdLine);
command.stdout.on('data', function(data) {
process.stdout.write(data);
});
command.stderr.on('data', function(data) {
process.stderr.write(data);
});
command.on('error', function(err) {
process.stderr.write(err);
});
View
@@ -6,6 +6,6 @@
</head>
<body>
<div id="root"></div>
<script src="/common.bundle.js"></script>
<script src="/demo-bundle.js"></script>
</body>
</html>
View
@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Fully React Maps!</title>
</head>
<body>
<div id="root"></div>
<script src="/static/demo-bundle.js"></script>
</body>
</html>
View
@@ -16,6 +16,7 @@
"homepage": "https://github.com/mariusandra/fully-react-maps#readme",
"scripts": {
"start": "./node_modules/.bin/webpack-dev-server --history-api-fallback --hot --port 4040",
"build:demo": "node build.js production",
"compile": "./node_modules/.bin/babel src --out-dir lib",
"watch": "./node_modules/.bin/babel -w src --out-dir lib",
"test": "echo \"Error: no test specified\" && exit 1"
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Fully React Maps!</title>
</head>
<body>
<div id="root"></div>
<script src="/demo-bundle.js"></script>
</body>
</html>
View
@@ -7,17 +7,11 @@ const isProd = nodeEnv === 'production'
var config = {
devtool: isProd ? 'hidden-source-map' : 'cheap-eval-source-map',
context: path.join(__dirname, './demo'),
entry: {
common: [
'babel-polyfill', 'react',
'./index.js'
]
},
entry: './index.js',
output: {
path: path.join(__dirname, './static'),
publicPath: '/',
filename: '[name].bundle.js',
chunkFilename: '[name].bundle.js'
filename: 'demo-bundle.js'
},
module: {
loaders: [
@@ -51,6 +45,15 @@ var config = {
plugins: [
new webpack.DefinePlugin({
'process.env': { NODE_ENV: JSON.stringify(nodeEnv) }
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
},
sourceMap: false
})
],
devServer: {
@@ -60,12 +63,11 @@ var config = {
// development mode
if (!isProd) {
Object.keys(config.entry).forEach(function (k) {
config.entry[k].unshift(
'webpack-dev-server/client?http://0.0.0.0:4040',
'webpack/hot/only-dev-server'
)
})
config.entry = [
'webpack-dev-server/client?http://0.0.0.0:4040',
'webpack/hot/only-dev-server',
config.entry
]
}
module.exports = config

0 comments on commit 147e490

Please sign in to comment.