-
Notifications
You must be signed in to change notification settings - Fork 23
/
webpack.config.js
executable file
·60 lines (58 loc) · 1.29 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
var webpack = require('webpack');
var path = require('path');
var precss = require('precss');
var cssnext = require('postcss-cssnext');
var vars = require('postcss-simple-vars');
var nested = require('postcss-nested');
var mixins = require('postcss-mixins');
module.exports = {
mode: "production",
entry: {
app: ['./src/Chartify.tsx'],
},
output: {
filename: "./index.js",
sourceMapFilename: './index.js.map',
library: 'Chartify',
libraryTarget: 'umd'
},
externals: {
'react': {
'commonjs': 'react',
'commonjs2': 'react',
'amd': 'react',
'root': 'React'
}
},
module: {
rules: [{
test: /\.js|\.ts|\.tsx?$/,
use: ['babel-loader'],
exclude: /node_modules/,
include: path.join(__dirname, '/src')
}, {
test: /\.css$/,
use: [
'style-loader',
{ loader: 'css-loader' },
{ loader: 'postcss-loader', options: { plugins: () => [...plugins] } }
]
}]
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json', '.css'],
},
resolveLoader: {
modules: ['node_modules'],
},
optimization: {
minimize: true
},
plugins: [
new webpack.LoaderOptionsPlugin({
options: {
postcss: [precss, cssnext, vars, nested, mixins],
},
}),
]
};