-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
61 lines (54 loc) · 1.42 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
import dotenv from 'dotenv';
dotenv.config();
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = fileURLToPath(import.meta.url);
import resolveTypeScriptPluginModule from 'resolve-typescript-plugin';
const ResolveTypeScriptPlugin = resolveTypeScriptPluginModule.default;
const entryPath = './app/assets/js/src';
const distPath = path.resolve(__dirname, '../app/assets/js/dist');
const config = {
mode: process.env.MODE,
entry: {
main: `${entryPath}/main.ts`,
animations: `${entryPath}/animations/example.js`,
autocomplete: `${entryPath}/autocomplete/example.js`,
assist: `${entryPath}/assist/example.js`,
contrast: `${entryPath}/contrast/contrast.ts`,
dragsort: `${entryPath}/dragsort/dragsort.js`,
expander: `${entryPath}/expander/expander.js`,
modal: `${entryPath}/modal/example.js`,
status: `${entryPath}/status/example.js`,
tooltip: `${entryPath}/tooltip/tooltip.js`,
validate: `${entryPath}/validate/example.js`,
},
output: {
path: distPath,
filename: '[name].js',
},
resolve: {
fullySpecified: true,
plugins: [new ResolveTypeScriptPlugin()],
},
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
},
],
},
};
switch (process.env.MODE) {
case 'development':
config.optimization = {
minimize: false,
};
config.devtool = 'eval-source-map';
break;
case 'production':
default:
config.devtool = 'source-map';
break;
}
export default config;