Skip to content

Commit 9ff65d4

Browse files
committed
initialize web directory
1 parent 68fdba8 commit 9ff65d4

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

web/public/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Portfolio Insights</title>
5+
<meta name="viewport" content="width=device-width">
6+
</head>
7+
<body>
8+
<div id="root"></div>
9+
<script src="bundle.js"></script>
10+
</body>
11+
</html>

web/webpack/web.dev.config.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const path = require('path');
2+
const webpack = require('webpack');
3+
4+
module.exports = {
5+
devtool: 'cheap-module-eval-source-map',
6+
entry: [
7+
'webpack-hot-middleware/client',
8+
'babel-polyfill',
9+
path.join(__dirname, '../../app/web/index'),
10+
],
11+
output: {
12+
path: path.join(__dirname, '../public'),
13+
filename: 'bundle.js',
14+
publicPath: '/',
15+
},
16+
module: {
17+
loaders: [
18+
// take all less files, compile them, and bundle them in with our js bundle
19+
{ test: /\.less$/, loader: 'style!css!autoprefixer?browsers=last 2 version!less' },
20+
{
21+
test: /\.js$/,
22+
exclude: /node_modules/,
23+
loader: 'babel-loader',
24+
query: {
25+
presets: ['es2015', 'react'],
26+
plugins: [['react-transform', {
27+
transforms: [{
28+
transform: 'react-transform-hmr',
29+
imports: ['react'],
30+
// this is important for Webpack HMR:
31+
locals: ['module']
32+
}],
33+
}]],
34+
},
35+
},
36+
],
37+
},
38+
plugins: [
39+
new webpack.DefinePlugin({
40+
'process.env': {
41+
NODE_ENV: JSON.stringify('development'),
42+
PLATFORM_ENV: JSON.stringify('web'),
43+
},
44+
}),
45+
new webpack.optimize.OccurenceOrderPlugin(),
46+
new webpack.HotModuleReplacementPlugin(),
47+
new webpack.NoErrorsPlugin(),
48+
],
49+
};

web/webpack/web.prod.config.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const path = require('path');
2+
const webpack = require('webpack');
3+
4+
module.exports = {
5+
entry: [
6+
path.join(__dirname, '../../app/web/index'),
7+
],
8+
output: {
9+
path: path.join(__dirname, '../public/'),
10+
filename: 'bundle.js',
11+
publicPath: '/',
12+
},
13+
module: {
14+
loaders: [
15+
// take all less files, compile them, and bundle them in with our js bundle
16+
{ test: /\.less$/, loader: 'style!css!autoprefixer?browsers=last 2 version!less' },
17+
{
18+
test: /\.js$/,
19+
exclude: /node_modules/,
20+
loader: 'babel-loader',
21+
query: {
22+
presets: ['es2015', 'react'],
23+
},
24+
},
25+
],
26+
},
27+
plugins: [
28+
new webpack.DefinePlugin({
29+
'process.env': {
30+
// Useful to reduce the size of client-side libraries, e.g. react
31+
NODE_ENV: JSON.stringify('production'),
32+
PLATFORM_ENV: JSON.stringify('web'),
33+
},
34+
}),
35+
// optimizations
36+
new webpack.optimize.DedupePlugin(),
37+
new webpack.optimize.OccurenceOrderPlugin(),
38+
new webpack.optimize.UglifyJsPlugin({
39+
compress: {
40+
warnings: false,
41+
},
42+
}),
43+
],
44+
};

0 commit comments

Comments
 (0)