-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathwebpack.config.js
More file actions
68 lines (67 loc) · 1.64 KB
/
webpack.config.js
File metadata and controls
68 lines (67 loc) · 1.64 KB
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
68
const path = require('path')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
module.exports = {
mode: 'development',
entry: './src/index.ts',
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js', '.jsx'],
alias: {
'@actions': path.resolve(__dirname, 'src/actions'),
'@core': path.resolve(__dirname, 'src/core'),
'@reducers': path.resolve(__dirname, 'src/reducers'),
'@constants': path.resolve(__dirname, 'src/constants'),
'@containers': path.resolve(__dirname, 'src/containers'),
'@middleware': path.resolve(__dirname, 'src/middleware'),
'@models': path.resolve(__dirname, 'src/models'),
'@utils': path.resolve(__dirname, 'src/utils'),
}
},
output: {
filename: 'index.js',
library: {
name: 'react-usb-barcode-scanner',
type: 'umd'
},
globalObject: 'this',
path: path.resolve(__dirname, 'dist')
},
externals: {
// Don't bundle react or react-dom
react: {
commonjs: 'react',
commonjs2: 'react',
amd: 'React',
root: 'React',
},
'react-dom': {
commonjs: 'react-dom',
commonjs2: 'react-dom',
amd: 'ReactDOM',
root: 'ReactDOM',
},
'react-redux': {
commonjs: 'react-redux',
commonjs2: 'react-redux',
amd: 'ReactRedux',
root: 'ReactRedux',
},
},
plugins: [
new CleanWebpackPlugin()
]
}