-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathwebpack.config.dist.js
67 lines (65 loc) · 1.69 KB
/
webpack.config.dist.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
/* eslint-disable import/no-extraneous-dependencies, no-console */
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const webpack = require('webpack');
const css = require('./css.config');
module.exports = {
entry: ['./src/index.js'],
externals: {
react: 'react',
'react-dom': 'react-dom',
lodash: 'lodash',
classnames: 'classnames',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
library: 'Plasma',
libraryTarget: 'umd',
},
resolve: {
modules: [path.resolve('./node_modules')],
extensions: ['.js', '.jsx'],
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
`css-loader?modules&importLoaders=1&localIdentName=${css.localIdentName}`,
'resolve-url-loader',
'sass-loader',
],
}),
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
`css-loader?importLoaders=1&localIdentName=${css.localIdentName}`,
'resolve-url-loader',
],
}),
},
{
test: /\.png$/,
loader: 'url-loader?limit=100000&mimetype=image/png',
},
],
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
new ExtractTextPlugin('styles.css'),
],
};