-
Notifications
You must be signed in to change notification settings - Fork 13
/
webpack.config.js
53 lines (50 loc) · 1.06 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
48
49
50
51
52
53
'use strict';
const webpack = require('webpack');
const { join } = require('path');
const config = {
mode: 'none',
entry: join(__dirname, 'vendor', 'ejson.js'),
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
parserOpts: { allowImportExportEverywhere: true },
plugins: ['import-to-require', 'add-module-exports'],
presets: [['@babel/preset-env', { modules: 'cjs' }]]
}
}
}
]
},
plugins: [
new webpack.ProvidePlugin({
Base64: [join(__dirname, 'vendor', 'base64.js'), 'Base64'],
Meteor: join(__dirname, 'vendor', 'meteor.js')
})
],
target: ['web', 'es5']
};
module.exports = [
{
...config,
output: {
filename: 'bundle.js',
library: 'EJSON',
libraryExport: 'EJSON',
libraryTarget: 'var',
path: __dirname
}
},
{
...config,
output: {
filename: 'index.js',
libraryExport: 'EJSON',
libraryTarget: 'commonjs2',
path: __dirname
}
}
];