-
Notifications
You must be signed in to change notification settings - Fork 120
/
webpack.common.js
63 lines (62 loc) · 1.42 KB
/
webpack.common.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
54
55
56
57
58
59
60
61
62
63
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
main: './src/index.ts',
frame: './src/frame.ts'
},
output: {
filename: '[name].bundle.js',
sourceMapFilename: "[name].js.map",
path: path.resolve(__dirname, 'dist'),
library: {
root: 'H5PStandalone',
amd: 'h5p-standalone',
commonjs: 'h5p-standalone'
},
libraryExport: "default",
libraryTarget: 'umd'
},
resolve: {
extensions: ['.js', '.ts'], //try if *js first then *.ts
},
module: {
rules: [
{
//H5P jquery should be exported under H5P variable
test: require.resolve(path.resolve(__dirname, 'vendor/h5p/js', 'jquery')),
use: 'exports-loader?exports=H5P'
},
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: [
["@babel/plugin-transform-runtime",
{
"regenerator": true
}
]
]
}
},
{
loader: 'ts-loader'
}
]
},
]
},
plugins: [
new CopyPlugin({
patterns: [
{ from: 'vendor/h5p/styles', to: 'styles' },
{ from: 'vendor/h5p/fonts', to: 'fonts' },
]
}),
]
};