blob: b2c884154c67c692eb78a0ade9265ef45fba3f31 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const path = require('path');
module.exports = (_env, argv) => {
let config = {
entry: './src/javascript/index.js',
output: {
path: path.resolve(__dirname, "dist"),
filename: "unomi-tracker.js",
library: {
name: "unomiTracker",
type: 'umd'
}
},
resolve: {
extensions: ['.js', '.jsx']
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: [
{
// Reference: https://github.com/babel/babel-loader
// Transpile .js files using babel-loader
// Compiles ES6 and ES7 into ES5 code
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', {
useBuiltIns: 'usage',
corejs: 3,
targets: {browsers: ['Safari >= 7', 'ie >= 10']}
}]],
plugins: [
['@babel/plugin-transform-for-of', {loose: true}]
],
cacheCompression: false
}
}
]
}]
}
};
if (argv.mode !== 'production') {
config.devtool = 'eval-source-map';
}
return config;
};