forked from video-react/video-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.config.js
More file actions
executable file
·132 lines (125 loc) · 3.39 KB
/
webpack.dev.config.js
File metadata and controls
executable file
·132 lines (125 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
const path = require('path');
const webpack = require('webpack');
const StaticSiteGeneratorPlugin = require('static-site-generator-webpack-plugin');
const env = process.env.WEBPACK_BUILD || 'development';
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const webpackDevConfig = require('./webpack.base.config')('development');
const webpackProdConfig = require('./webpack.base.config')('production');
const paths = [
'/',
'/components/',
'/components/player/',
'/components/shortcut/',
'/components/big-play-button/',
'/components/poster-image/',
'/components/loading-spinner/',
'/components/control-bar/',
'/components/play-toggle/',
'/components/forward-control/',
'/components/replay-control/',
'/components/volume-menu-button/',
'/components/playback-rate-menu-button/',
'/customize/',
'/customize/enable-disable-components/',
'/customize/customize-source/',
'/customize/customize-component/',
'/404.html',
];
const config = [{
devtool: 'source-map',
devServer: {
contentBase: './build',
historyApiFallback: true,
host: '0.0.0.0',
port: 9000,
stats: {
chunks: false,
},
},
entry: {
main: ['babel-polyfill', './docs/lib/app'],
},
node: {
fs: 'empty',
},
output: {
filename: 'bundle.js',
path: './build',
libraryTarget: 'umd',
},
plugins: [
new CleanWebpackPlugin(['build']),
new CopyWebpackPlugin([
{ from: './docs/static', to: 'assets' },
{ from: './dist', to: 'assets' },
]),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(env),
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new StaticSiteGeneratorPlugin('main', paths, {}),
new webpack.NoErrorsPlugin(),
new ExtractTextPlugin('/assets/style.css'),
],
module: {
loaders: [
{
test: /\.json$/,
loaders: [
'json-loader?cacheDirectory',
],
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
cacheDirectory: true,
presets: ['es2015','stage-0', 'react'],
},
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader'),
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader'),
},
{
test: /\.woff(2)?(\?[a-z0-9=&.]+)?$/,
loader: 'url-loader?limit=10000&minetype=application/font-woff',
},
{ test: /\.(ttf|eot|svg)(\?[a-z0-9=&.]+)?$/,
loader: 'url-loader?limit=30000&name=[name]-[hash].[ext]',
},
],
},
resolve: {
extensions: ['', '.js', '.json'],
alias: {
'bootstrap-scss': path.join(__dirname, 'node_modules/bootstrap/scss/bootstrap.scss'),
'video-react-scss': path.resolve('./styles/scss/video-react.scss'),
'video-react': path.resolve('./src'),
},
},
}];
if (env === 'development') {
config.push(webpackDevConfig);
config.push(webpackProdConfig);
} else {
config[0].plugins.push(new webpack.optimize.UglifyJsPlugin(
{
minimize: true,
sourceMap: true,
compress: {
warnings: false,
},
mangle: true,
},
));
}
module.exports = config;