-
Notifications
You must be signed in to change notification settings - Fork 9
/
webpack.config.js
74 lines (71 loc) · 1.68 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
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
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const config = {
NODE_ENV: process.env,
};
const PRODUCTION = config.NODE_ENV === 'production';
const DEVELOPMENT = config.NODE_ENV === 'development';
module.exports = {
devtool: '#cheap-module-source-map',
entry: {
index: ['./src/react-scifi.js']
},
output: {
path: path.resolve(__dirname, 'lib'),
filename: 'react-scifi.js',
sourceMapFilename: 'react-scifi.map',
library: 'ReactScifi',
libraryTarget: 'umd'
},
externals: {
'react': 'react',
'react-dom': 'react-dom',
'react-motion': 'react-motion',
'prop-types': 'prop-types',
},
resolve: {
modules: [
path.resolve('./src'),
path.resolve('./src/components'),
'node_modules',
],
extensions: ['.json', '.js', '.jsx']
},
module: {
rules: [
{
enforce: 'pre',
test: /\.jsx?$/,
use: PRODUCTION ? 'eslint-loader' : 'eslint-loader?{emitWarning: true}',
exclude: /node_modules/,
},
{
test: /\.jsx?$/,
use: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader',
}),
include: /node_modules/,
},
{
test: /\.styl$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{ loader: 'css-loader' },
{ loader: 'stylus-loader' },
],
}),
},
],
},
plugins: [
new ExtractTextPlugin('styles.css'),
],
};