-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.js
More file actions
34 lines (28 loc) · 992 Bytes
/
Copy pathwebpack.config.js
File metadata and controls
34 lines (28 loc) · 992 Bytes
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
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?localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader') }
]
},
// Provide the Local Scope plugin to postcss-loader:
postcss: [ require('postcss-local-scope') ],
plugins: [
new ExtractTextPlugin('style.css', { allChunks: true }),
new ReactToHtmlPlugin('index.html', 'index.js', {
template: ejs.compile(fs.readFileSync(__dirname + '/src/template.ejs', 'utf-8'))
})
]
};