forked from mderrick/react-html5video
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generateConfig.js
executable file
·54 lines (52 loc) · 1.64 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
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: 'commonjs2',
library: pkg.name
},
resolve: {
extensions: ['.js', '.json', '.jsx', '']
},
externals: [{
react: 'react',
'react-dom': 'react-dom',
'prop-types': 'prop-types'
}],
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=rh5v-[name]_[local]&-autoprefixer!postcss')
}, {
test: /\.(eot|ttf|woff|woff2)(\?.*)?$/,
loader: 'url'
}]
},
plugins: [
new ExtractTextPlugin('styles.css'),
new CaseSensitivePathsPlugin()
]
};
};