-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
50 lines (47 loc) · 1.41 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
// Webpack uses this to work with directories
const path = require("path");
const webpack = require("webpack");
const TerserPlugin = require("terser-webpack-plugin");
const PATHS = {
entryPoint: path.resolve(__dirname, 'src/index.tsx'),
bundles: path.resolve(__dirname, 'dist'),
}
// This is the main configuration object.
// Here, you write different options and tell Webpack what to do
module.exports = {
// Path to your entry point. From this file Webpack will begin its work
entry: {
'bundle': [PATHS.entryPoint],
'bundle.min': [PATHS.entryPoint]
},
module: {
// Webpack doesn't understand TypeScript files and a loader is needed.
// `node_modules` folder is excluded in order to prevent problems with
// the library dependencies, as well as `__tests__` folders that
// contain the tests for the library
rules: [
{test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{ test: /\.css$/, use: [ 'style-loader', 'css-loader' ] }
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
devtool: 'source-map',
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
// Path and filename of your result bundle.
// Webpack will bundle all JavaScript into this file
output: {
path: PATHS.bundles,
filename: '[name].js',
libraryTarget: 'umd',
library: 'react-snap-svg-ts',
umdNamedDefine: true
},
};