-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathwebpack.sdk.config.js
49 lines (48 loc) · 1.3 KB
/
webpack.sdk.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
const path = require('path')
const webpack = require('webpack')
const TerserPlugin = require('terser-webpack-plugin')
const FlowWebpackPlugin = require('flowtype-webpack-plugin')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const ESLintPlugin = require('eslint-webpack-plugin')
const packageJson = require('./package.json')
const namespace = 'adjust-sdk'
const version = packageJson.version
module.exports = () => ({
mode: 'production',
entry: {
'adjust-latest': path.resolve(__dirname, 'src/sdk/main.js'),
'adjust-latest.min': path.resolve(__dirname, 'src/sdk/main.js')
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
library: 'Adjust',
libraryTarget: 'umd',
libraryExport: 'default'
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
include: /\.min\.js$/
})]
},
plugins: [
new ESLintPlugin(),
new webpack.DefinePlugin({
__ADJUST__NAMESPACE: JSON.stringify(namespace),
__ADJUST__SDK_VERSION: JSON.stringify(version)
}),
new FlowWebpackPlugin(),
new ForkTsCheckerWebpackPlugin()
],
resolve: {
extensions: ['.ts', '.js', '.json']
},
module: {
rules: [{
use: 'babel-loader',
test: /\.(js|ts)$/,
exclude: /node_modules/
}]
}
})