forked from mderrick/react-html5video
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generateConfig.js
executable file
·63 lines (61 loc) · 1.9 KB
/
generateConfig.js
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
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const pkg = require('./package.json');
const srcPath = path.resolve(__dirname, 'src');
const distPath = path.resolve(__dirname, 'dist');
module.exports = (options = {}) => {
return {
entry: [
path.resolve(srcPath, 'entry.js')
],
target: 'web',
output: {
path: options.outputPath || distPath,
filename: 'index.js',
libraryTarget: 'umd',
library: pkg.name
},
resolve: {
extensions: ['.js', '.json', '.jsx', '']
},
externals: [{
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom'
}
}],
module: {
loaders: [{
test: /\.(js|jsx)$/,
include: srcPath,
loader: 'babel',
query: {
cacheDirectory: true
}
}, {
test: /\.svg$/,
loader: 'babel!react-svg'
}, {
test: /\.css$/,
include: srcPath,
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[hash:base64:5]&hashPrefix=react-html5video&-autoprefixer!postcss')
}, {
test: /\.(eot|ttf|woff|woff2)(\?.*)?$/,
loader: 'url'
}]
},
plugins: [
new ExtractTextPlugin('styles.css'),
new CaseSensitivePathsPlugin()
]
};
};