forked from JSKitty/scc-web3
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathwebpack.dev.js
53 lines (50 loc) · 1.57 KB
/
webpack.dev.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
/* istanbul ignore file */
/* eslint-env node */
/* eslint @typescript-eslint/no-var-requires: "off" */
import path from 'path';
import { merge } from 'webpack-merge';
import common from './webpack.common.js';
import webpack from 'webpack';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { execSync } from 'child_process';
import { readFileSync } from 'fs';
const __dirname = dirname(fileURLToPath(import.meta.url));
const commitHash = execSync('git rev-parse --short HEAD').toString().trim();
const version = JSON.parse(
readFileSync('./package.json', { encoding: 'utf8' })
).version;
export default merge(common, {
mode: 'development',
devServer: {
static: {
directory: path.join(__dirname, './'),
watch: {
ignored: [
// ignore changes in '.git' subdirectory (prevent constant hot-reloading in auto-fetch configurations)
'**/.git',
/node_modules/,
/coverage/,
],
},
},
compress: true,
port: 5500,
hot: true,
allowedHosts: ['all'],
client: {
overlay: false,
},
headers: {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin',
},
},
plugins: [
new webpack.DefinePlugin({
__VUE_OPTIONS_API__: false,
__VUE_PROD_DEVTOOLS__: true,
VERSION: JSON.stringify(`${version}-${commitHash}`),
}),
],
});