/
webpack.config.js
88 lines (81 loc) · 2.15 KB
/
webpack.config.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const path = require('path');
const fs = require('fs');
const mkcert = require('mkcert');
// Relative path of the directory where the SDK and Plugin are located
const sdkAndPluginDirPath = '../../../../'
const sdkDirs = fs.readdirSync(sdkAndPluginDirPath);
// Get one directory where the SDK is located
function getSdkDirectory() {
const sdkRepo = new RegExp('CubismWebSamples*|CubismSdkForWeb*');
return sdkAndPluginDirPath + sdkDirs.filter(dir => sdkRepo.test(dir))[0];
}
module.exports = async ()=> {
// Create local CA.
const ca = await mkcert.createCA({
organization: "Test CA",
countryCode: "US",
state: "California",
locality: "San Francisco",
validity: 365
});
// Issue a simple certificate for localhost.
const certData = await mkcert.createCert({
ca: { key: ca.key, cert: ca.cert },
domains: ["127.0.0.1", "localhost"],
validity: 365
});
const key = certData.key;
const cert = certData.cert;
return {
mode: 'production',
target: ['web', 'es6'],
entry: './src/mainmotionsync.ts',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/dist/'
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
'@framework': path.resolve(__dirname, getSdkDirectory() + '/Framework/src'),
'@cubismsdksamples': path.resolve(__dirname, getSdkDirectory() + '/Samples/TypeScript/Demo/src'),
'@motionsyncframework': path.resolve(__dirname, '../../../Framework/src')
}
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
loader: 'ts-loader'
}
]
},
devServer: {
static: [
{
directory: path.resolve(__dirname, sdkAndPluginDirPath),
serveIndex: true,
watch: true,
}
],
hot: true,
port: 5000,
host: '0.0.0.0',
compress: true,
devMiddleware: {
writeToDisk: true,
},
// Set the connection to https.
server: {
type: 'https',
options: {
key,
cert,
},
},
},
devtool: 'inline-source-map'
}
}