1 |
|
2 |
|
3 | const path = require('path');
|
4 | const webpack = require('webpack');
|
5 | const version = require('./package-lock.json').version;
|
6 | const mode = process.env.NODE_ENV || 'production';
|
7 |
|
8 | const bundle = {
|
9 | mode: mode,
|
10 | devtool: mode === 'development' ? 'inline-source-map' : false,
|
11 | entry: './src/main.js',
|
12 | output: {
|
13 | path: path.resolve(__dirname, 'dist'),
|
14 | filename: 'daily-iframe.js',
|
15 | library: 'DailyIframe',
|
16 | libraryTarget: 'umd',
|
17 | globalObject: 'this',
|
18 | },
|
19 | plugins: [
|
20 | new webpack.DefinePlugin({
|
21 | 'process.env': {
|
22 | NODE_ENV: JSON.stringify(mode),
|
23 | },
|
24 | __dailyJsVersion__: JSON.stringify(version),
|
25 | }),
|
26 | ],
|
27 | module: {
|
28 | rules: [
|
29 | {
|
30 | test: /\.js$/,
|
31 | exclude: /(node_modules)/,
|
32 | use: {
|
33 | loader: 'babel-loader',
|
34 | options: {
|
35 | presets: ['@babel/preset-env'],
|
36 | plugins: [
|
37 | '@babel/plugin-transform-runtime',
|
38 | '@babel/plugin-proposal-class-properties',
|
39 | ],
|
40 | },
|
41 | },
|
42 | },
|
43 | ],
|
44 | },
|
45 | };
|
46 |
|
47 | module.exports = [bundle];
|