-
Notifications
You must be signed in to change notification settings - Fork 150
/
Copy pathwebpack.config.js
47 lines (44 loc) · 1.19 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
var path = require('path')
var webpack = require('webpack')
const useLocalSwipeable = process.env.DEV_LOCAL === 'true';
if (useLocalSwipeable) {
console.info('*****')
console.info('NOTE: Using local copy of react-swipeable: src/index.ts')
console.info('*****')
}
module.exports = {
devtool: 'cheap-module-eval-source-map',
entry: ['./index'],
resolve: {
extensions: [ '.tsx', '.ts', '.js' ],
...(useLocalSwipeable && {
alias: {
'react-swipeable': path.resolve(__dirname, '../src/index.ts'),
// Have to alias react to avoid two versions
'react': path.resolve(__dirname, '../examples/node_modules/react/index.js')
}
})
},
output: {
path: path.join(__dirname, 'static'),
publicPath: '/static/',
filename: 'bundle.js'
},
plugins: [
new webpack.DefinePlugin({
// retrieve react-swipeable version to display on demo page
SWIPEABLE_VERSION: useLocalSwipeable ? JSON.stringify('DEV') : JSON.stringify(
require('./node_modules/react-swipeable/package.json').version
)
})
],
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
]
}
}