-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
40 lines (38 loc) · 1 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
'use strict'
const path = require('path');
const webpack = require('webpack');
module.exports = (env) => {
const DISTRIBUTION = env && env.DISTRIBUTION === 'true';
return {
resolve: {
extensions: ['.ts', '.js'],
},
entry: ['./src/index'],
module: {
rules: [
{
test: /\.ts$/,
enforce: 'pre',
loader: "tslint-loader",
exclude: [/node_modules/],
include: path.join(__dirname, './src'),
},
{
test: /\.ts$/,
exclude: [/node_modules/],
use: 'ts-loader',
include: path.join(__dirname, './src'),
},
],
},
devtool: !DISTRIBUTION && 'inline-source-map',
output: {
path: path.join(__dirname, DISTRIBUTION ? 'lib' : 'build'),
filename: DISTRIBUTION ? 'smartEco.min.js' : 'bundle.js',
libraryTarget: "umd",
library: 'smartEco',
libraryExport: 'default',
globalObject: 'typeof self !== \'undefined\' ? self : this',
},
};
};