forked from jcputney/scorm-again
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.js
More file actions
77 lines (75 loc) · 1.71 KB
/
webpack.js
File metadata and controls
77 lines (75 loc) · 1.71 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const path = require('path');
const webpack = require('webpack');
const ESLintPlugin = require('eslint-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const JSLoader = {
test: /\.js$/i,
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
'corejs': '3',
'useBuiltIns': 'entry',
'targets': {
'browsers': [
'edge >= 16',
'safari >= 9',
'firefox >= 57',
'ie >= 11',
'ios >= 9',
'chrome >= 49',
],
},
},
],
['@babel/preset-flow'],
],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
'@babel/plugin-proposal-optional-chaining',
],
},
},
};
module.exports = {
mode: 'development',
devtool: 'source-map',
entry: {
'scorm-again': './src/exports/scorm-again.js',
'scorm-again.min': './src/exports/scorm-again.js',
},
target: ['web', 'es5'],
module: {
rules: [
JSLoader,
],
},
output: {
path: path.resolve(__dirname, 'dist'),
library: 'ScormAgain',
libraryTarget: 'umd',
filename: '[name].js',
umdNamedDefine: true,
globalObject: 'this',
environment: {
arrowFunction: false,
},
},
optimization: {
minimize: true,
minimizer: [new UglifyJsPlugin({
include: /\.min\.js$/,
})],
},
plugins: [
new ESLintPlugin({
overrideConfigFile: path.resolve(__dirname, '.eslintrc.js'),
context: path.resolve(__dirname, '../src'),
files: '**/*.js',
}),
],
};