-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.ts
68 lines (65 loc) · 1.86 KB
/
webpack.common.ts
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
import path from 'path';
import {Compiler, Configuration, WebpackPluginInstance} from 'webpack';
export const ROOT = path.resolve(__dirname, '.');
interface CommonConfig extends Configuration {
plugins: (((this: Compiler, compiler: Compiler) => void) | WebpackPluginInstance)[];
}
export const commonConfig: CommonConfig = {
entry: [path.resolve(__dirname, 'src/ApexTree.ts')],
output: {
clean: true,
filename: 'ApexTree.js',
path: path.resolve(__dirname, 'dist'),
library: 'ApexTree',
libraryTarget: 'umd',
libraryExport: 'ApexTree',
},
module: {
rules: [
{
// Include ts, tsx, js, and jsx files.
test: /\.(ts|js)?$/,
include: [ROOT],
exclude: [/node_modules/],
use: [
{
loader: 'babel-loader',
options: {
// Rely on babel loading it's `babel.config.js` file. If we need to edit it for
// Hot Module Reloading support so be it.
// https://gist.github.com/rmoorman/94eeed830942758e218d92f15ce58d88
presets: [['@babel/preset-env', {targets: 'defaults'}]],
plugins: ['@babel/plugin-proposal-class-properties', '@babel/plugin-transform-runtime'],
},
},
],
},
{
test: /\.ts?$/,
include: [ROOT],
exclude: [/node_modules/],
use: [
'babel-loader',
{
loader: 'ts-loader',
options: {
configFile: 'tsconfig.json',
transpileOnly: true,
experimentalWatchApi: true,
},
},
],
},
{test: /\.(less)$/, loader: 'asset/resource'},
{
test: /\.svg$/,
loader: 'raw-loader',
},
],
},
resolve: {
modules: [__dirname, 'src', 'node_modules'],
extensions: ['.ts', '.js'],
},
plugins: [],
};