Repository navigation
Expand file tree
/
Copy pathwebpack.config.babel.js
More file actions
101 lines (94 loc) · 2.91 KB
/
Copy pathwebpack.config.babel.js
File metadata and controls
101 lines (94 loc) · 2.91 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import webpack from 'webpack';
import { join } from 'path';
import AutoPrefixer from 'autoprefixer';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
const isProd = (process.env.NODE_ENV === 'production');
const include = join(__dirname, 'src');
export default {
entry: './src/demo/index',
output: {
path: join(__dirname, 'docs'),
filename: 'bundle.js',
},
devtool: isProd ? '' : 'source-map',
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
include,
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.scss$/,
/*use: [
'style-loader',
{
loader: 'css-loader',
options: {
sourceMap: true,
importLoaders: 2,
},
},
{
loader: 'postcss-loader',
options: {
plugins() {
return [AutoPrefixer];
},
},
},
{
loader: 'sass-loader',
options: {
precision: 8,
outputStyle: 'expanded',
},
},
],*/
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
minimize: true,
importLoaders: 2,
},
},
{
loader: 'postcss-loader',
options: {
plugins() {
return [AutoPrefixer];
},
},
},
{
loader: 'sass-loader',
options: {
precision: 8,
outputStyle: 'expanded',
},
},
],
}),
},
],
},
plugins: [
new webpack.DefinePlugin({
NODE_ENV: process.env.NODE_ENV,
}),
new ExtractTextPlugin({
filename: '../src/styles/reactour.css',
disable: !isProd,
}),
],
devServer: {
contentBase: 'docs/',
},
};