-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
65 lines (63 loc) · 1.71 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
const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin')
const extractSass = new ExtractTextPlugin({
filename: '[name].[contenthash].css',
})
module.exports = {
entry: {
main: path.resolve('src', 'index.js'),
filters: path.resolve('src', 'filters', 'index.js'),
renderers: path.resolve('src', 'data-renderers', 'index.js'),
cells: path.resolve('src', 'types', 'index.js'),
utils: path.resolve('src', 'utils', 'index.js'),
icons: path.resolve('src', 'icons', 'index.js'),
},
output: {
path: path.resolve(__dirname),
filename: '[name].js',
libraryTarget: 'umd',
library: 'react-object-list',
},
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
}, {
test: /\.(scss|sass)$/,
exclude: /node_modules/,
use: extractSass.extract({
use: [{
loader: 'css-loader', // translates CSS into CommonJS
options: {
minimize: true,
},
}, {
loader: 'resolve-url-loader', // resolve relative urls inside the css files
}, {
loader: 'sass-loader?sourceMap', // compiles Sass to CSS
}],
}),
}, {
test: /\.(woff2?|eot|ttf|svg|otf)(\?.+)?$/i,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
name: '[name].[hash].[ext]',
},
},
],
}],
},
plugins: [
extractSass,
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new PeerDepsExternalsPlugin(),
],
}