-
Notifications
You must be signed in to change notification settings - Fork 10
/
webpack.config.js
44 lines (42 loc) · 1023 Bytes
/
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
var path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
// library configuration
var libraryName = 'tritra';
var outputFile = path.join('js', libraryName + '.js');
module.exports = {
entry: './src/lib/index.js',
devtool: 'source-map',
output: {
path: path.resolve(__dirname, 'dist'),
filename: outputFile,
library: libraryName,
libraryTarget: 'umd',
globalObject: 'typeof self !== \'undefined\' ? self : this'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
]
},
plugins: [
new HtmlWebpackPlugin({
title: 'Triangle Tracker Example',
template: './src/examples/tracker/index.ejs',
filename: 'examples/index-tracker.html',
inject: 'head'
})
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: false,
host: '0.0.0.0',
port: 8080
}
};