-
Notifications
You must be signed in to change notification settings - Fork 180
/
webpack.config.js
42 lines (35 loc) · 1.16 KB
/
webpack.config.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
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var ReactToHtmlPlugin = require('react-to-html-webpack-plugin');
var path = require('path');
var ejs = require('ejs');
var fs = require('fs');
module.exports = {
entry: './src/index.js',
output: {
filename: 'index.js',
path: path.resolve('./dist'),
libraryTarget: 'umd'
},
module: {
loaders: [
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader') },
{ test: /\.svg$/, loader: "url-loader?limit=10000&mimetype=image/svg+xml" }
]
},
postcss: [
require('autoprefixer-core'),
require('postcss-color-rebeccapurple')
],
resolve: {
modulesDirectories: ['node_modules', 'components']
},
plugins: [
new ExtractTextPlugin('style.css', { allChunks: true }),
new ReactToHtmlPlugin('index.html', 'index.js', {
static: true,
template: ejs.compile(fs.readFileSync(__dirname + '/src/template.ejs', 'utf-8'))
})
]
};