-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.cjs
52 lines (51 loc) · 1.3 KB
/
webpack.config.cjs
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
const path = require('path');
const webpack = require('webpack');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const PreloadWebpackPlugin = require('@vue/preload-webpack-plugin');
module.exports = (env, argv) => ({
entry: './examples/index.ts',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
}
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
plugins: [new TsconfigPathsPlugin()]
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'docs', 'examples'),
clean: true
},
plugins: [
new HtmlWebpackPlugin({
template: 'examples/index.html'
}),
new PreloadWebpackPlugin(),
new webpack.DefinePlugin({
OL_MBTILES_DEBUG: JSON.stringify(!!process.env.OL_MBTILES_DEBUG)
}),
],
devtool: argv.mode === 'production' ? 'source-map' : 'inline-source-map',
devServer: {
static: {
directory: path.join(__dirname, 'examples'),
},
headers: {
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp'
},
compress: true,
port: 9000,
}
});