forked from opensheetmusicdisplay/opensheetmusicdisplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
63 lines (62 loc) · 2.02 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
var path = require('path')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var webpack = require('webpack')
module.exports = {
entry: {
opensheetmusicdisplay: './src/index.ts', // Main index (OpenSheetMusicDisplay and other classes)
demo: './demo/index.js' // Demo index
},
output: {
path: path.resolve(__dirname, 'build'),
filename: '[name].js',
library: 'opensheetmusicdisplay',
libraryTarget: 'umd',
globalObject: 'this'
},
resolve: {
// Add '.ts' and '.tsx' as a resolvable extension.
extensions: ['.ts', '.tsx', '.js']
},
module: {
rules: [
// all files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'
{
test: /\.ts$/,
loader: 'ts-loader',
// loader: 'awesome-typescript-loader',
exclude: /(node_modules|bower_components)/
},
{
test: /\.glsl$/,
type: "asset/source",
exclude: /(node_modules|bower_components)/
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
}),
new webpack.EnvironmentPlugin({
STATIC_FILES_SUBFOLDER: false, // Set to other directory if NOT using webpack-dev-server
DEBUG: false,
DRAW_BOUNDING_BOX_ELEMENT: false // Specifies the element to draw bounding boxes for (e.g. 'GraphicalLabels'). If 'all', bounding boxes are drawn for all elements.
}),
// add a demo page to the build folder
new HtmlWebpackPlugin({
template: 'demo/index.html',
favicon: 'demo/favicon.ico',
title: 'OpenSheetMusicDisplay Demo'
})
],
devServer: {
static: [
path.join(__dirname, 'test/data'),
path.join(__dirname, 'build'),
path.join(__dirname, 'demo')
],
port: 8000,
compress: false
}
}