-
Notifications
You must be signed in to change notification settings - Fork 120
/
webpack.common.js
69 lines (68 loc) · 2.32 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
64
65
66
67
68
69
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
main: './src/js/index.js',
frame: './src/js/frame.js'
},
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: {
alias: {
h5pjquery: require.resolve(path.resolve(__dirname, 'vendor/h5p/js', 'jquery')),
H5P: path.resolve(__dirname, 'vendor/h5p/js', 'h5p'),
H5PIntegration: require.resolve(path.resolve(__dirname, 'src/js', 'h5p-integration')),
H5PEventDispatcher: require.resolve(path.resolve(__dirname, 'vendor/h5p/js', 'h5p-event-dispatcher')),
H5PxAPI: require.resolve(path.resolve(__dirname, 'vendor/h5p/js', 'h5p-x-api')),
H5PxAPIEvent: require.resolve(path.resolve(__dirname, 'vendor/h5p/js', 'h5p-x-api-event')),
H5PContentType: require.resolve(path.resolve(__dirname, 'vendor/h5p/js', 'h5p-content-type')),
H5PActionBar: require.resolve(path.resolve(__dirname, 'vendor/h5p/js', 'h5p-action-bar')),
H5PRequestQueue: require.resolve(path.resolve(__dirname, 'vendor/h5p/js', 'request-queue')),
H5PConfirmationDialog: require.resolve(path.resolve(__dirname, 'vendor/h5p/js', 'h5p-confirmation-dialog')),
'h5p-standalone': require.resolve(path.resolve(__dirname, 'src/js', 'index'))
}
},
module: {
rules: [
{
test: require.resolve(path.resolve(__dirname, 'vendor/h5p/js', 'h5p')),
use: ['exports-loader?exports=default|H5P', 'imports-loader?imports=default|h5pjquery|jQuery'],
},
{
test: /src\/.*\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: [
["@babel/plugin-transform-runtime",
{
"regenerator": true
}
]
]
}
}
},
]
},
plugins: [
new CopyPlugin({
patterns: [
{ from: 'vendor/h5p/styles', to: 'styles' },
{ from: 'vendor/h5p/fonts', to: 'fonts' },
]
}),
]
};