Repository navigation
Expand file tree
/
Copy pathwebpack.config.prod.js
More file actions
102 lines (100 loc) · 2.24 KB
/
Copy pathwebpack.config.prod.js
File metadata and controls
102 lines (100 loc) · 2.24 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
102
const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
externals: [
{
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom',
},
},
{
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
},
],
resolve: {
extensions: ['.js', '.jsx', '.json'],
modules: [
'node_modules',
path.join(__dirname, 'src'),
],
},
devtool: 'source-map',
entry: './src/index.js',
output: {
filename: 'react-carousel.js',
library: 'react-carousel',
libraryTarget: 'umd',
path: path.resolve(__dirname, 'lib'),
umdNamedDefine: true,
globalObject: 'this',
},
plugins: [
new UglifyJsPlugin({
sourceMap: false,
}),
new ExtractTextPlugin('style.css'),
new webpack.DefinePlugin({
// This fixes https://github.com/brainhubeu/react-carousel/issues/115
'process.env.NODE_ENV': process.env.NODE_ENV,
}),
],
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
mimetype: 'image/svg+xml',
},
},
],
},
{
test: /(\.css|\.scss)$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
sourceMap: true,
},
},
{
loader: 'postcss-loader',
options: {
sourceMap: true,
plugins: () => [autoprefixer],
},
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
},
},
],
}),
},
],
},
};