-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.common.js
More file actions
102 lines (95 loc) · 3.27 KB
/
webpack.common.js
File metadata and controls
102 lines (95 loc) · 3.27 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
Index: path.resolve(__dirname, `src/Index.ts`)
},
output: {
filename: `[name].js`,
library: `[name]`,
path: path.resolve(__dirname, 'dist'),
libraryExport: 'default',
libraryTarget: 'umd',
umdNamedDefine: true
},
module: {
rules: [
// All files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{
test: /\.tsx?$/,
use: [{
loader: 'ts-loader',
options: {
// Only transpile, typechecking will be done in a separate thread
// so we can develop without roadblocks.
transpileOnly: true
}
}]
},
// Regular css loader.
// {
// test: /\.css$/,
// use: [
// 'style-loader', // Creates `style` nodes from JS strings
// 'css-loader' // Translates CSS into CommonJS
// ]
// },
// SCSS loader.
// {
// test: /\.scss$/,
// use: [
// 'style-loader', // Creates `style` nodes from JS strings
// 'css-loader', // Translates CSS into CommonJS
// 'sass-loader' // Compiles Sass to CSS
// ]
// },
// {
// test: /\.(csv|tsv)$/,
// use: {
// loader: 'csv-loader',
// options: {
// header: true,
// dynamicTyping: true,
// skipEmptyLines: true
// }
// }
// },
// Checks for any images and if they are smaller
// than 100kb they will encoded as base64.
// {
// test: /\.(png|jp(e*)g|svg)$/,
// use: [{
// loader: 'url-loader',
// options: {
// limit: 100000, // Limit 100kb
// name: 'images/[hash]-[name].[ext]',
// publicPath: '',
// }
// }]
// },
// Loaders for shaders.
// {
// test: /\.(glsl|vs|fs|vert|frag)$/,
// exclude: /node_modules/,
// use: ['raw-loader', 'glslify-loader']
// },
// Loader for fonts to bake in fonts into the build.
// {
// test: /\.(woff2?|eot|ttf|otf)$/,
// loader: 'url-loader',
// options: {
// limit: 100000, // Limit 100kb
// name: 'fonts/[hash]-[name].[ext]',
// publicPath: '',
// }
// }
]
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
plugins: [
// Copy the index html so we can test the dist folder.
new CopyWebpackPlugin([{ from: './src/html/index.html', to: 'index.html' }]),
]
};