-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
57 lines (56 loc) · 1.14 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
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
context: `${__dirname}/src`,
entry: {
debut: './index.tsx',
},
output: {
path: `${__dirname}/dist`,
filename: '[name].js',
libraryTarget: 'umd',
library: 'debut',
},
module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader',
},
],
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: 'css-loader!postcss-loader'
}),
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.css'],
modules: [path.resolve('node_modules'), path.resolve('.')],
},
plugins: [
new ExtractTextPlugin('[name].css'),
],
externals: {
'react': {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom',
},
},
devtool: '#source-map',
};